Filter
What would you like to search for?
Backend API
Fields
Unique identifier for the payment.
ID of the customer's account the payment was made for.
Payment amount denominated in currency. Minimum of 0.01
Method of payment. Can be card, account, amazon, paypal or any one of the manual methods defined in payment settings.
Expandable link to the customer's account that made the payment.
ID of the customer's credit card on file used to make the payment, if applicable.
Expandable link to the customer's credit card on file used to make the payment, if applicable.
Amazon billing details used when method=amazon.
Amazon access token provided when a customer authorizes payment in a storefront.
Amazon order reference ID created when a customer initiates payment in a storefront.
Remaining amount that can be refunded.
Amount of the payment that has been refunded.
Indicates the payment is processed asynchronously. The payment will be updated in the future while success is undefined.
Indicates the payment was authorized before being captured.
Indicates the payment has been captured.
Credit card details used to make the payment, if applicable.
A temp token generated by Swell Checkout or Stripe.js, or a permanent card token assigned after submitting a temporary token (starting with card_).
Two-digit number representing the credit card expiration month.
Four-digit number representing the credit card expiration year.
Credit card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
Last four digits of the card number.
Indicates this is a test card.
When used with a payment gateway that performs address checks and address1 was provided, can be pass, fail, unavailable, or unchecked.
When used with a payment gateway that performs address checks and zip was provided, can be pass, fail, unavailable, or unchecked.
When used with a payment gateway that performs CVC code checks and cvc was provided, can be pass, fail, unavailable, or unchecked.
Three-letter ISO currency code in uppercase. Defaults to the store's base currency.
Currency percentage used in calculating the fixed amount.
Date and time the payment was created.
Date and time the payment was last updated.
An object describing an error that occurred while interacting with the payment gateway, if applicable.
Unique error code.
A message describing the error.
ID of the payment gateway that was used to process the payment.
Expandable link to gift card used to make the payment, if applicable.
ID of the gift card used to make the payment, if applicable.
ID of the invoice the payment was applied to, if applicable.
Expandable link to the invoice the payment was applied to, if applicable.
Unique incremental payment number assigned automatically.
ID of the order the payment was applied to, if applicable.
Expandable link to the order the payment was applied to, if applicable.
PayPal billing details used when billing.method=paypal.
PayPal payer ID provided when a customer authorizes payment in a storefront.
PayPal payment ID created when a customer initiates payment in a storefront.
Expandable list of refunds issued for the payment.
Status of the payment. Can be pending, which is awaiting async processing, error, success or authorized.
ID of the subscription the payment was applied to, if applicable.
Expandable link to the subscription the payment was applied to, if applicable.
Indicates the payment was successful. When an error occurs with a payment gateway, this status will be false and error field will be populated.
Indicates the payment was made with a gateway in test mode.
External identifier returned by a payment gateway, if applicable.
The date of the next time the payment status will be updated.
The intent of the external payment provider. See the external payment provider’s documentation for how intent is implemented.
The payment model
{
"id": "60f199509111e70000000056",
"account_id": "60f199509111e7000000005a",
"amount": 50,
"method": "card",
"account_card_id": "60f199509111e70000000058",
"amount_refundable": 30,
"amount_refunded": 20,
"async": false,
"authorized": true,
"captured": true,
"card": {
"token": "card_1Ds1K7E30PFlZWil6Q7bJ1PD",
"test": true,
"last4": "4242",
"brand": "Visa",
"address_check": "unchecked",
"zip_check": "unchecked",
"cvc_check": "unchecked",
"exp_month": 1,
"exp_year": 2029
},
"currency": "USD",
"date_created": "2021-07-16T14:36:00.313Z",
"date_updated": "2021-07-16T14:36:00.313Z",
"error": null,
"gateway": "stripe",
"number": 2973512,
"order_id": "60f199509111e70000000059",
"status": "success",
"success": true,
"test": true,
"transaction_id": "ch_1XNoXdEAeofUkt5SrbA6Swow"
}
Create a new payment.
Arguments
ID of the customer's account the payment was made for.
Payment amount denominated in currency. Minimum of 0.01
Method of payment. Can be card, account, amazon, paypal or any one of the manual methods defined in payment settings.
Credit card details used to make the payment, if applicable.
A temp token generated by Swell Checkout or Stripe.js, or a permanent card token assigned after submitting a temporary token (starting with card_).
Two-digit number representing the credit card expiration month.
Four-digit number representing the credit card expiration year.
Credit card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
Last four digits of the card number.
Indicates this is a test card.
When used with a payment gateway that performs address checks and address1 was provided, can be pass, fail, unavailable, or unchecked.
When used with a payment gateway that performs address checks and zip was provided, can be pass, fail, unavailable, or unchecked.
When used with a payment gateway that performs CVC code checks and cvc was provided, can be pass, fail, unavailable, or unchecked.
ID of the invoice the payment was applied to, if applicable.
ID of the order the payment was applied to, if applicable.
ID of the customer's credit card on file used to make the payment, if applicable.
Amazon billing details used when method=amazon.
Amazon access token provided when a customer authorizes payment in a storefront.
Amazon order reference ID created when a customer initiates payment in a storefront.
Indicates the payment was authorized before being captured.
Indicates the payment has been captured.
Three-letter ISO currency code in uppercase. Defaults to the store's base currency.
An object describing an error that occurred while interacting with the payment gateway, if applicable.
Unique error code.
A message describing the error.
ID of the gift card used to make the payment, if applicable.
PayPal billing details used when billing.method=paypal.
PayPal payer ID provided when a customer authorizes payment in a storefront.
PayPal payment ID created when a customer initiates payment in a storefront.
Indicates the payment was successful. When an error occurs with a payment gateway, this status will be false and error field will be populated.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.post('/payments', {
amount: 50,
method: 'card',
card: { token: 'card_XfqLq5nRdOdu7vTvoeKufafN' },
account_id: '5c899d4f7d7920749638dc4e',
});
Response
{
"id": "5cae685b20a54174dd968afa",
"account_id": "5c899d4f7d7920749638dc4e",
"amount": 50,
"amount_refundable": 50,
"authorized": true,
"captured": true,
"card": {
"brand": "Visa",
"last4": "4242",
"exp_month": 10,
"exp_year": 2029,
"token": "card_XfqLq5nRdOdu7vTvoeKufafN",
"cvc_check": "pass",
"zip_check": "pass",
"address_check": "pass"
},
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"gateway": "stripe",
"method": "card",
"number": "1947367",
"order_id": "5cae685b20a54174dd968077",
"status": "success",
"success": true,
"transaction_id": "ch_1XNoXdEAeofUkt5SrbA6Swow"
}
Retrieve an existing payment using the ID that was returned when created.
Arguments
The id of the payment to retrieve.
Expanding link fields and child collections is performed using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
Return only the specified fields in the result. For example fields=name,slug would return only the fields name and slug in the response. Supports nested object and array fields using dot-notation.
- For example, items.product_id. The category id is always returned.
Include one or more arbitrary queries in the response, possibly related to the main query.
See including for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/payments/{id}', {
id: '5cae685b20a54174dd968afa',
});
Response
{
"id": "5cae685b20a54174dd968afa",
"account_id": "5c899d4f7d7920749638dc4e",
"amount": 50,
"amount_refundable": 50,
"authorized": true,
"captured": true,
"card": {
"brand": "Visa",
"last4": "4242",
"exp_month": 10,
"exp_year": 2029,
"token": "card_XfqLq5nRdOdu7vTvoeKufafN",
"cvc_check": "pass",
"zip_check": "pass",
"address_check": "pass"
},
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"date_updated": "2019-04-01T00:00:00.000Z",
"gateway": "stripe",
"method": "card",
"number": "1947367",
"order_id": "5cae685b20a54174dd968077",
"status": "success",
"success": true,
"transaction_id": "ch_1XNoXdEAeofUkt5SrbA6Swow"
}
Arguments
Amount to refund up to payment amount_refundable.
Optionally refund the payment using a different method. Defaults to the original payment method.
The reason of the refund.
A brief message describing the reason for the refund.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.post('/payments/{id}/refunds', {
id: '5cae685b20a54174dd968afa',
amount: 50,
});
Response
{
"id": "5cae042722984c53002096ab",
"amount": 50,
"card": {
"brand": "Visa",
"last4": "4242",
"exp_month": 10,
"exp_year": 2029,
"token": "card_XfqLq5nRdOdu7vTvoeKufafN",
"cvc_check": "pass",
"zip_check": "pass",
"address_check": "pass"
},
"currency": "USD",
"date_created": "2019-04-01T00:00:00.000Z",
"gateway": "stripe",
"method": "card",
"number": "103352",
"order_id": "5cae685b20a54174dd968077",
"parent_id": "5cae685b20a54174dd968afa",
"status": "success",
"success": true,
"transaction_id": "re_1XNhqtFAeoMUkt5CitcnPNAa"
}
Return a list of payments.
Arguments
Expand link fields and child collections by using the expand argument.
- For example, expand=account would return a related customer account if one exists.
When the field represents a collection, you can specify the query limit.
- For example, expand=variants:10 would return up to 10 records of the variants collection.
See expanding for more details.
Returns only the specified fields in the result.
- For example fields=name,slug would return only the fields name and slug in the response.
Supports nested object and array fields using dot-notation.
- For example, items.product_id. The product id is always returned.
Include one or more arbitrary queries in the response which are potentially related to the main query.
See including for more details.
Limit the number of records returned, ranging between 1 and 1000. Defaults to 15.
The page number of results to return given the specified or default limit.
A text search is performed using the search argument. Searchable fields are defined by the model.
- For example, search=red would return records containing the word "red" anywhere in the defined text fields.
See searching for more details.
Expression to sort results by using a format similar to a SQL sort statement.
- For example, sort=name asc would return records sorted by name ascending.
See sorting for more details.
An object with criteria to filter the result.
- For example, active=true would return records containing a field active with the value true.
It's also possible to use query operators, for example, $eq, $ne, $gt, and more.
See querying for more details.
const swell = require('swell-node').init('store-id', 'secret-key');
await swell.get('/payments', {
limit: 25,
page: 1
});
Response
{
"count": 51,
"results": [
{
"id": "60f199509111e70000000056",
"account_id": "60f199509111e7000000005e",
"amount": 50,
"method": "card",
"account_card_id": "60f199509111e70000000058",
"amount_refundable": 30,
"amount_refunded": 20,
"async": false,
"authorized": true,
"captured": true,
"card": {
"token": "card_1Ds1K7E30PFlZWil6Q7bJ1PD",
"test": true,
"last4": "4242",
"brand": "Visa",
"address_check": "unchecked",
"zip_check": "unchecked",
"cvc_check": "unchecked",
"exp_month": 1,
"exp_year": 2029
},
"currency": "USD",
"date_created": "2021-07-16T14:36:00.313Z",
"date_updated": "2021-07-16T14:36:00.313Z",
"error": null,
"gateway": "stripe",
"number": 2973512,
"order_id": "60f199509111e70000000059",
"status": "success",
"success": true,
"test": true,
"transaction_id": "ch_1XNoXdEAeofUkt5SrbA6Swow"
},
{...},
{...}
],
"page": 1,
"pages": {
"1": {
"start": 1,
"end": 25
},
"2": {
"start": 26,
"end": 50
},
"2": {
"start": 51,
"end": 51
}
}
}