Skip to main content
POST
/
api
/
v3
/
store
/
carts
/
{cart_id}
/
payments
Spree SDK
import { createClient } from '@spree/sdk'

const client = createClient({
  baseUrl: 'https://your-store.com',
  publishableKey: '<api-key>',
})

const payment = await client.carts.payments.create('cart_abc123', {
  payment_method_id: 'pm_abc123',
}, {
  bearerToken: '<token>',
})
{
  "id": "py_UkLWZg9DAJ",
  "payment_method_id": "pm_UkLWZg9DAJ",
  "response_code": null,
  "number": "P4X4IXCS",
  "amount": "110.0",
  "display_amount": "$110.00",
  "status": "checkout",
  "source_type": null,
  "source_id": null,
  "source": null,
  "payment_method": {
    "id": "pm_UkLWZg9DAJ",
    "name": "Check",
    "description": null,
    "type": "Spree::PaymentMethod::Check",
    "session_required": false
  }
}

Authorizations

x-spree-api-key
string
header
required

Publishable API key for store access

Authorization
string
header
required

JWT token for authenticated customers

Headers

x-spree-api-key
string
required
Authorization
string
x-spree-token
string

Order token for guest access

Path Parameters

cart_id
string
required

Cart prefixed ID

Body

application/json
payment_method_id
string
required

Payment method ID (must be a non-session payment method)

Example:

"pm_abc123"

amount
string

Payment amount (defaults to order total minus store credits)

Example:

"99.99"

metadata
object

Arbitrary metadata to attach to the payment

Response

payment created

id
string
required
payment_method_id
string
required
response_code
string | null
required
number
string
required
amount
string
required
display_amount
string
required
status
string
required
source_type
enum<string> | null
required
Available options:
credit_card,
store_credit,
payment_source
source_id
string | null
required
source
object
required
payment_method
object
required