Pay (1.0.0)

Download OpenAPI specification:Download

E-mail: support@fabric.inc License: fabric Inc

fabric Pay APIs.

Customer Payment Profile

Customer payment profile APIs

Add customer

Add customer

Request
Request Body schema: application/json
object (Address)

The customer’s address.

description
string

An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.

email
string <email> <= 512 characters

Customer’s email address.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

name
string >= 3 characters

The customer’s full name or business name.

payment_method
string

The ID of the PaymentMethod to attach to the customer.

object

Default invoice settings for this customer.

phone
string

The customer’s phone number.

object (Shipping)

Mailing and shipping address for the customer. Appears on invoices emailed to this customer.

Responses
200

Customer was created successfuly

400

A generic client error

500

Internal Server Error

post/customer
Request samples
application/json
{
  • "address": {
    },
  • "description": "This is example text.",
  • "email": "johnsmith@fabric.inc",
  • "metadata": { },
  • "name": "John Smith",
  • "payment_method": "pm_1GulN6FbKq2PvwXbAWV9JJEc",
  • "invoice_settings": {
    },
  • "phone": "123-123-1234",
  • "shipping": {
    }
}
Response samples
application/json
{
  • "id": "cus_8epDebVEl8Bs2V",
  • "object": "customer",
  • "address": {
    },
  • "balance": 0,
  • "created": 1466202923,
  • "currency": "usd",
  • "default_source": "card_18NVYR2eZvKYlo2CQ2ieV9S5",
  • "delinquent": true,
  • "description": "My First Test Customer (created for API docs)",
  • "discount": {
    },
  • "email": "mia.wilson.99@example.com",
  • "invoice_prefix": "D86E170",
  • "invoice_settings": {
    },
  • "livemode": false,
  • "metadata": {
    },
  • "name": "John Smith",
  • "next_invoice_sequence": 113288,
  • "phone": "123-123-1234",
  • "preferred_locales": [
    ],
  • "shipping": {
    },
  • "tax_exempt": "exempt"
}

Get customer

If customer exists and was not deleted you will get a Customer object

If customer exists but was deleted you will get a DeletedCustomer object

Request
path Parameters
customerId
required
string
Responses
200

Get customer successfuly

400

A generic client error

500

Internal Server Error

get/customer/{customerId}
Response samples
application/json
{
  • "id": "cus_8epDebVEl8Bs2V",
  • "object": "customer",
  • "address": {
    },
  • "balance": 0,
  • "created": 1466202923,
  • "currency": "usd",
  • "default_source": "card_18NVYR2eZvKYlo2CQ2ieV9S5",
  • "delinquent": true,
  • "description": "My First Test Customer (created for API docs)",
  • "discount": {
    },
  • "email": "mia.wilson.99@example.com",
  • "invoice_prefix": "D86E170",
  • "invoice_settings": {
    },
  • "livemode": false,
  • "metadata": {
    },
  • "name": "John Smith",
  • "next_invoice_sequence": 113288,
  • "phone": "123-123-1234",
  • "preferred_locales": [
    ],
  • "shipping": {
    },
  • "tax_exempt": "exempt"
}

Update customer

Update customer

Request
path Parameters
customerId
required
string
Request Body schema: application/json
object (Address)

The customer’s address.

description
string

An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.

email
string <email> <= 512 characters

Customer’s email address.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

name
string >= 3 characters

The customer’s full name or business name.

payment_method
string

The ID of the PaymentMethod to attach to the customer.

object

Default invoice settings for this customer.

phone
string

The customer’s phone number.

object (Shipping)

Mailing and shipping address for the customer. Appears on invoices emailed to this customer.

Responses
200

Customer was retrieved successfully

400

A generic client error

500

Internal Server Error

patch/customer/{customerId}
Request samples
application/json
{
  • "address": {
    },
  • "description": "This is example text.",
  • "email": "johnsmith@fabric.inc",
  • "metadata": { },
  • "name": "John Smith",
  • "payment_method": "pm_1GulN6FbKq2PvwXbAWV9JJEc",
  • "invoice_settings": {
    },
  • "phone": "123-123-1234",
  • "shipping": {
    }
}
Response samples
application/json
{
  • "id": "cus_8epDebVEl8Bs2V",
  • "object": "customer",
  • "address": {
    },
  • "balance": 0,
  • "created": 1466202923,
  • "currency": "usd",
  • "default_source": "card_18NVYR2eZvKYlo2CQ2ieV9S5",
  • "delinquent": true,
  • "description": "My First Test Customer (created for API docs)",
  • "discount": {
    },
  • "email": "mia.wilson.99@example.com",
  • "invoice_prefix": "D86E170",
  • "invoice_settings": {
    },
  • "livemode": false,
  • "metadata": {
    },
  • "name": "John Smith",
  • "next_invoice_sequence": 113288,
  • "phone": "123-123-1234",
  • "preferred_locales": [
    ],
  • "shipping": {
    },
  • "tax_exempt": "exempt"
}

Delete customer

Delete Customer by Customer Id

Request
path Parameters
customerId
required
string
Responses
200

Customer was successfuly deleted

400

A generic client error

500

Internal Server Error

delete/customer/{customerId}
Response samples
application/json
{
  • "id": "cus_8epDebVEl8Bs2V",
  • "object": "customer",
  • "deleted": true
}

Get customers

Request
Request Body schema: application/json
email
string <email>

A case-sensitive filter on the list based on the customer’s email field. The value must be a string.

object (Created)

A filter on the list based on the object created field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options

limit
integer [ 1 .. 100 ]

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

starting_after
string

A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

ending_before
string

A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

Responses
200

List of Customers successfuly retrieved

400

A generic client error

500

Internal Server Error

post/customers
Request samples
application/json
{
  • "email": "johnsmith@fabric.inc",
  • "created": {
    },
  • "limit": 10,
  • "starting_after": "cus_HU71SS7faWPfVQ",
  • "ending_before": "cus_HU71SS7faWPfVQ"
}
Response samples
application/json
{
  • "object": "list",
  • "url": "/v1/customers",
  • "has_more": false,
  • "data": [
    ]
}

Attach payment method to customer

Test

Request
path Parameters
paymentMethodId
required
string
Request Body schema: application/json
customer
string

The ID of the customer to which to attach the PaymentMethod.

Responses
200

Attaching a Payment Method to a Customer was successful

400

A generic client error

500

Internal Server Error

post/payment-method/{paymentMethodId}/attach
Request samples
application/json
{
  • "customer": "cus_HZlDXNXLHSOcLj"
}
Response samples
application/json
{
  • "id": "pm_1Jc71c2eZvKYlo2C5EpxHvnY",
  • "object": "payment_method",
  • "billing_details": {
    },
  • "card": {
    },
  • "created": 12345678,
  • "customer": null,
  • "livemode": false,
  • "metadata": {
    },
  • "type": "card"
}

Detach payment method from customer

Request
path Parameters
paymentMethodId
required
string
Responses
200

Detach a Payment Method from a Customer by Payment Method Id was successful

400

A generic client error

500

Internal Server Error

post/payment-method/{paymentMethodId}/detach
Response samples
application/json
{
  • "id": "pm_1Jc71c2eZvKYlo2C5EpxHvnY",
  • "object": "payment_method",
  • "billing_details": {
    },
  • "card": {
    },
  • "created": 12345678,
  • "customer": null,
  • "livemode": false,
  • "metadata": {
    },
  • "type": "card"
}

Payment Intent

Payment intent APIs

Get payment intent

Get Payment Intent by Id

Request
path Parameters
paymentIntentId
required
string
Responses
200

Payment Intent was successfuly retrieved

400

A generic client error

500

Internal Server Error

get/payment-intent/{paymentIntentId}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Update payment intent

Request
path Parameters
paymentIntentId
required
string
Request Body schema: application/json
amount
number

Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).

currency
string

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer
string

ID of the Customer this PaymentIntent belongs to, if one exists. Payment methods attached to other Customers cannot be used with this PaymentIntent.

payment_method
string

ID of the payment method used in this PaymentIntent.

payment_method_options
object

Payment-method-specific configuration for this PaymentIntent.

payment_method_types
Array of strings

The list of payment method types (e.g. card) that this PaymentIntent is allowed to use.

receipt_email
string

Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings.

setup_future_usage
string

Indicates that you intend to make future payments with this PaymentIntent’s payment method. Providing this parameter will attach the payment method to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes. When processing card payments, Pay also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA. Use on_session if you intend to only reuse the payment method when your customer is present in your checkout flow. Use off_session if your customer may or may not be present in your checkout flow.

Enum: "on_session" "off_session"
capture_method
string

Controls when the funds will be captured from the customer’s account.

object (TransferData)

The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents use case for connected accounts for details.

Responses
200

Payment Intent was successfuly updated

400

A generic client error

500

Internal Server Error

patch/payment-intent/{paymentIntentId}
Request samples
application/json
{
  • "amount": 1099,
  • "currency": "eur",
  • "customer": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "setup_future_usage": "on_session",
  • "capture_method": "automatic",
  • "transfer_data": {
    }
}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Cancel payment intent

Request
path Parameters
paymentIntentId
required
string
Request Body schema: application/json
cancellation_reason
string
Default: "requested_by_customer"

Reason for canceling this PaymentIntent.

Enum: "duplicate" "fraudulent" "requested_by_customer" "abandoned"
Responses
200

Payment Intent Successfully Canceled

400

A generic client error

500

Internal Server Error

delete/payment-intent/{paymentIntentId}
Request samples
application/json
{
  • "cancellation_reason": "requested_by_customer"
}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Create payment intent

Request
Request Body schema: application/json
amount
number

Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or equivalent in charge currency. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).

currency
string

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer
string

ID of the Customer this PaymentIntent belongs to, if one exists. Payment methods attached to other Customers cannot be used with this PaymentIntent.

confirm
boolean
Default: false

Set to true to attempt to confirm this PaymentIntent immediately. This parameter defaults to false. When creating and confirming a PaymentIntent at the same time, parameters available in the confirm API may also be provided.

off_session
boolean
Default: false

Set to true to indicate that the customer is not in your checkout flow during this payment attempt, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with confirm=true.

string or object

ID of the payment method (a PaymentMethod, Card, or compatible Source object) to attach to this PaymentIntent. If this parameter is omitted with confirm=true, customer.default_source will be attached as this PaymentIntent’s payment instrument to improve the migration experience for users of the Charges API. We recommend that you explicitly provide the payment_method going forward.

payment_method_types
Array of strings

The list of payment method types (e.g. card) that this PaymentIntent is allowed to use.

receipt_email
string <email>

Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings.

setup_future_usage
string

Indicates that you intend to make future payments with this PaymentIntent’s payment method. Providing this parameter will attach the payment method to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes. When processing card payments, Pay also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA. Use on_session if you intend to only reuse the payment method when your customer is present in your checkout flow. Use off_session if your customer may or may not be present in your checkout flow.

Enum: "on_session" "off_session"
object (TransferData)

The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents use case for connected accounts for details.

metadata
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Responses
200

Payment Intent was successfuly created

400

A generic client error

500

Internal Server Error

post/payment-intent
Request samples
application/json
{
  • "amount": 1099,
  • "currency": "eur",
  • "customer": null,
  • "confirm": false,
  • "off_session": false,
  • "payment_method": "pm_1Gsv4BFbKq2PvwXbl4XEl1O3",
  • "payment_method_types": [
    ],
  • "receipt_email": "joedoe@fabric.inc",
  • "setup_future_usage": "off_session",
  • "transfer_data": {
    },
  • "metadata": { }
}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Confirm payment intent

Request
path Parameters
paymentIntentId
required
string
Request Body schema: application/json
payment_method
string

ID of the payment method (a PaymentMethod, Card, or compatible Source object) to attach to this PaymentIntent.

receipt_email
string <email>

Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings.

setup_future_usage
string

Indicates that you intend to make future payments with this PaymentIntent’s payment method. Providing this parameter will attach the payment method to the PaymentIntent’s Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be attached to a Customer after the transaction completes. When processing card payments, Pay also uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA. If setup_future_usage is already set and you are performing a request using a publishable key, you may only update the value from on_session to off_session.

Enum: "on_session" "off_session"
Responses
200

Confirm payment intent was successsful

400

A generic client error

500

Internal Server Error

post/payment-intent/confirm/{paymentIntentId}
Request samples
application/json
{
  • "payment_method": "pm_1Gsv4BFbKq2PvwXbl4XEl1O3",
  • "receipt_email": "joedoe@fabric.inc",
  • "setup_future_usage": "off_session"
}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Capture payment intent

Request
path Parameters
paymentIntentId
required
string
Request Body schema: application/json
amount_to_capture
integer >= 1
object (TransferData)

The data with which to automatically create a Transfer when the payment is finalized. See the PaymentIntents use case for connected accounts for details.

Responses
200

Capture Payment Intent was successful

400

A generic client error

500

Internal Server Error

post/payment-intent/capture/{paymentIntentId}
Request samples
application/json
{
  • "amount_to_capture": 1000,
  • "transfer_data": {
    }
}
Response samples
application/json
{
  • "id": "pi_1DpRqg2eZvKYlo2CDp9Ko99t",
  • "object": "payment_intent",
  • "amount": 1099,
  • "amount_capturable": 0,
  • "amount_received": 0,
  • "application": null,
  • "application_fee_amount": null,
  • "canceled_at": null,
  • "cancellation_reason": null,
  • "capture_method": "automatic",
  • "charges": {
    },
  • "client_secret": "pi_1DpRqg2eZvKYlo2CDp9Ko99t_secret_4QlXQ5gMV3Es2MlgKOY1pbXMc",
  • "confirmation_method": "automatic",
  • "created": 1546743530,
  • "currency": "eur",
  • "customer": null,
  • "description": null,
  • "invoice": null,
  • "last_payment_error": {
    },
  • "livemode": false,
  • "metadata": { },
  • "next_action": null,
  • "on_behalf_of": null,
  • "payment_method": "pm_123abcdef123",
  • "payment_method_options": {
    },
  • "payment_method_types": [
    ],
  • "receipt_email": null,
  • "review": null,
  • "setup_future_usage": "off_session",
  • "shipping": {
    },
  • "statement_descriptor": null,
  • "statement_descriptor_suffix": null,
  • "status": "requires_payment_method",
  • "transfer_data": {
    },
  • "transfer_group": null
}

Payment Method

Payment method APIs

Get payment method

Request
path Parameters
paymentMethodId
required
string
Responses
200

Get Payment Method by Id was successful

400

A generic client error

500

Internal Server Error

get/payment-method/{paymentMethodId}
Response samples
application/json
{
  • "id": "pm_1Jc71c2eZvKYlo2C5EpxHvnY",
  • "object": "payment_method",
  • "billing_details": {
    },
  • "card": {
    },
  • "created": 12345678,
  • "customer": null,
  • "livemode": false,
  • "metadata": {
    },
  • "type": "card"
}

Get payment methods by customer

Request
Request Body schema: application/json
customer
required
string

The ID of the customer whose PaymentMethods will be retrieved.

type
string
Default: "card"

A required filter on the list, based on the object type field.

Enum: "au_becs_debit" "bacs_debit" "bancontact" "card" "eps" "fpx" "giropay" "ideal" "p24" "sepa_debit"
limit
integer [ 1 .. 100 ]

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

starting_after
string

A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

ending_before
string

A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

Responses
200

List Payment Methods was successful

400

A generic client error

500

Internal Server Error

post/payment-methods
Request samples
application/json
{
  • "customer": "cus_HZlDXNXLHSOcLj",
  • "type": "card",
  • "limit": 10,
  • "starting_after": "pm_1H0bhA2eZvKYlo2ClFepu5sQ",
  • "ending_before": "pm_1H0bhA2eZvKYlo2ClFepu5sQ"
}
Response samples
application/json
{
  • "object": "list",
  • "url": "/v1/payment_methods",
  • "has_more": false,
  • "data": [
    ]
}

Refund

Refund APIs

Create refund

Creates a full refund if amount is not provided or is equal to the amount of payment intent. Partial refund is created upon providing amount lesser than the payment intent.

Request
Request Body schema: application/json
amount
integer >= 1

A positive integer in cents representing how much of this charge to refund. Can refund only up to the remaining, unrefunded amount of the charge.

payment_intent
string

ID of the PaymentIntent to refund.

reason
string
Default: "requested_by_customer"

String indicating the reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer. If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists, and will also help us improve our fraud detection algorithms.

Enum: "duplicate" "fraudulent" "requested_by_customer"
refund_application_fee
boolean
Default: false

Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge.

Responses
200

Create Refund was successful

400

A generic client error

500

Internal Server Error

post/refund
Request samples
application/json
{
  • "amount": 1000,
  • "payment_intent": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",
  • "reason": "requested_by_customer",
  • "refund_application_fee": false
}
Response samples
application/json
{
  • "id": "re_3Jc9Yc2eZvKYlo2C0pfyXwjx",
  • "object": "refund",
  • "amount": 100,
  • "balance_transaction": null,
  • "charge": "ch_3Jc9Yc2eZvKYlo2C0NpFs8Yt",
  • "created": 1632232972,
  • "currency": "usd",
  • "description": "description",
  • "metadata": { },
  • "payment_intent": "pi_1IdQBOJxr7zyIFb9qX4HxzL1",
  • "reason": "expired_uncaptured_charge",
  • "receipt_number": null,
  • "source_transfer_reversal": null,
  • "status": "succeeded",
  • "transfer_reversal": null
}

Get refund

Request
path Parameters
refundId
required
string
Responses
200

Get Refund was successful

400

A generic client error

500

Internal Server Error

get/refund/{refundId}
Response samples
application/json
{
  • "id": "re_3Jc9Yc2eZvKYlo2C0pfyXwjx",
  • "object": "refund",
  • "amount": 100,
  • "balance_transaction": null,
  • "charge": "ch_3Jc9Yc2eZvKYlo2C0NpFs8Yt",
  • "created": 1632232972,
  • "currency": "usd",
  • "description": "description",
  • "metadata": { },
  • "payment_intent": "pi_1IdQBOJxr7zyIFb9qX4HxzL1",
  • "reason": "expired_uncaptured_charge",
  • "receipt_number": null,
  • "source_transfer_reversal": null,
  • "status": "succeeded",
  • "transfer_reversal": null
}

Update refund

Request
path Parameters
refundId
required
string
Request Body schema: application/json
object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Responses
200

Update Refund was successful

400

A generic client error

500

Internal Server Error

patch/refund/{refundId}
Request samples
application/json
{ }
Response samples
application/json
{
  • "id": "re_3Jc9Yc2eZvKYlo2C0pfyXwjx",
  • "object": "refund",
  • "amount": 100,
  • "balance_transaction": null,
  • "charge": "ch_3Jc9Yc2eZvKYlo2C0NpFs8Yt",
  • "created": 1632232972,
  • "currency": "usd",
  • "description": "description",
  • "metadata": { },
  • "payment_intent": "pi_1IdQBOJxr7zyIFb9qX4HxzL1",
  • "reason": "expired_uncaptured_charge",
  • "receipt_number": null,
  • "source_transfer_reversal": null,
  • "status": "succeeded",
  • "transfer_reversal": null
}

Get refunds for a payment intent

Request
Request Body schema: application/json
payment_intent
string

Only return refunds for the PaymentIntent specified by this ID.

object (Created)

A filter on the list based on the object created field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options

limit
integer [ 1 .. 100 ]

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

starting_after
string

A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.

ending_before
string

A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.

Responses
200

List Refunds was successful

400

A generic client error

500

Internal Server Error

post/refunds
Request samples
application/json
{
  • "payment_intent": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",
  • "created": {
    },
  • "limit": 10,
  • "starting_after": "re_1GtLjtFbKq2PvwXb52R6Qek3",
  • "ending_before": "re_1GtLjtFbKq2PvwXb52R6Qek3"
}
Response samples
application/json
{
  • "object": "list",
  • "url": "/v1/refunds",
  • "has_more": false,
  • "data": [
    ]
}