OptionaldefaultLocationId: stringCreate a payment
Payment creation options
Created payment
// Simple payment
const payment = await square.payments.create({
sourceId: 'cnon:card-nonce-ok',
amount: 1000, // $10.00 in cents
idempotencyKey: 'order-1042', // one key per order, so a retry can't charge twice
});
// Payment with all options
const payment = await square.payments.create({
sourceId: 'cnon:card-nonce-ok',
amount: 1000,
currency: 'USD',
customerId: 'CUST_123',
orderId: 'ORDER_123',
note: 'Payment for order #123',
autocomplete: true,
buyerEmailAddress: 'buyer@example.com',
statementDescriptionIdentifier: 'ORDER123',
idempotencyKey: 'order-123-payment',
});
// Merchant-initiated charge of a card on file (e.g. a renewal)
const payment = await square.payments.create({
sourceId: 'ccof:CARD_123',
customerId: 'CUST_123',
amount: 1000,
customerDetails: { customerInitiated: false, sellerKeyedIn: false },
idempotencyKey: 'renewal-SUB_123-2026-12',
});
Simplified payments service
Example