SubblySubbly
Log inGet started
  • Get started
  • Developer resources
Private API reference
Docs
Information
    Base URLAuthenticationPaginationErrors
Customer
    Get list of customersCreate a customerGet customer by IDUpdate a customerDelete a customerChange a customer's store credit balanceCreate a customer noteUpdate a customer noteDelete a customer note
Address
    Create an addressUpdate an addressDelete an address
Pickup Info
    Get list of pickup infoCreate pickup infoUpdate pickup infoDelete pickup info
Subscription
    Get list of subscriptionsCreate a subscriptionGet subscription by IDUpdate a subscriptionCancel a subscriptionUndo cancellationPause a subscriptionResume a subscriptionSkip renewals until a dateReactivate a cancelled or expired subscriptionSwitch the subscription to another plan by starting overChange the plans of the subscription's itemsUpdate a subscription's shipping address and methodUpdate a subscription's payment methodUpdate a subscription's survey preferencesCreate a subscription itemShow a subscription itemUpdate a subscription itemRemove a subscription itemUpdate a subscription item's preferencesUpdate a subscription item's bundleChange the plan of a subscription itemChange the variant of a one-time itemApply a discount to a subscription itemRemove a subscription item discountApply a discount to a subscriptionRemove a subscription discount
Invoice
    Get list of invoicesGet invoice by IDSchedule the next payment for invoiceVoid an invoiceForgive an invoiceMark an invoice as paid
Order
    Get list of ordersGet order by IDUpdate an orderShip an orderCancel an orderMark an order as pendingArchive an orderMark an order as a future shipmentSync order shipping items
Payment Method
    Create a payment methodGet payment method by IDDelete a payment method
Transaction
    Get list of transactionsGet transaction by ID
Cancellation
    Get shop cancellation reasons
Product
    Get list of productsGet product by IDGet variant by IDUpdate variantGet plan by IDUpdate planCreate subscription productUpdate subscription productPublish subscription productUnpublish subscription productArchive subscription productSync subscription product metadataCreate one-time productUpdate one-time productPublish one-time productUnpublish one-time productArchive one-time productSync one-time product metadataCreate variantArchive variantBatch create/update/archive variantsCreate planArchive plan
Survey
    Get survey by IDGet list of surveys
Bundle
    Get list of bundlesCreate a new bundleGet bundle by IDUpdate a bundleGet list of bundle itemsCreate a bundle itemBatch create bundle itemsGet bundle item by IDUpdate a bundle itemDelete a bundle itemGet list of bundle groupsPublish a bundleUnpublish a bundleArchive a bundleSync bundle metadataCreate a bundle planGet bundle plan by IDUpdate a bundle planArchive a bundle plan
Tag
    Get list of tags
Metafield
    Get shop's metafieldsCreate a new metadataUpdate the metadata
Funnel
    Get list of funnelsGet funnel by ID
Option
    Get list of options
Country
    Get list of countries
Inventory
    Get list of inventory itemsCreate a new inventory itemGet inventory item by IDUpdate an inventory itemArchive an inventory itemGet list of inventory groupsCreate a new inventory groupGet inventory group by IDUpdate an inventory group
Coupon
    Get list of couponsCreate a couponGet coupon by IDUpdate a couponArchive a coupon
Product Collection
    Get list of product collectionsCreate a product collectionGet product collection by IDUpdate a product collectionPublish a product collectionUnpublish a product collectionArchive a product collectionGet list of collection groups with itemsSync collection items

Payment Method

Private Payment Method API endpoints

Endpoints
  • POST/payment_methods
  • GET/payment_methods/{payment_method_id}
  • DELETE/payment_methods/{payment_method_id}

Create a payment method

POST /payment_methods

Store a payment method for a customer of your shop from a gateway-side token. The token is exchanged with the gateway; only the shape of token is validated up front, so a token the gateway rejects surfaces as a server error rather than a validation error. When the customer has no default payment method yet and the gateway is in live mode, the new payment method becomes the default.

Request body

customer_idRequiredinteger

ID of the customer the payment method belongs to.

gateway_idRequiredinteger

ID of a payment gateway belonging to your shop.

tokenRequiredstring

Gateway-side token for the payment instrument, for example a Stripe payment method ID or a Braintree nonce. It is exchanged with the gateway on the spot.

ReturnsPaymentMethod

Payment method object response

Error responses

422object

Validation failed, for example a customer_id that is not a customer of your shop, a missing token, or a gateway_id that does not belong to your shop.

curl -X POST https://api.subbly.co/private/v1/payment_methods \ -H 'X-API-KEY: <api-key>' \ -H 'Content-Type: application/json' \ -d '{ "customer_id": 1, "gateway_id": 1, "token": "token" }'
Response
{ "id": 567, "type": "card", "identifier": "4242", "currencies": [ "USD", "EUR" ], "card": { "last_four": "4242", "expiry_month": "2", "expiry_year": "2099", "type": "credit", "brand": "visa" }, "ideal": { "bank": "ING", "bic": "INGBNL2A", "email": "test@subbly.co", "name": "John Doe" }, "bancontact": { "email": "test@subbly.co", "name": "John Doe" }, "acss_debit": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "Royal Bank of Canada", "transit_number": "12345", "institution_number": "123", "last_four": "6789" }, "us_bank_account": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "US Bank", "last4": "6789", "routing_number": "123456789", "account_type": "checking", "account_holder_type": "individual" }, "sepa_debit": { "email": "test@subbly.co", "name": "John Doe", "iban_last4": "6789", "bank_code": "123456", "country": "DE", "branch_code": "12345" }, "sofort": { "email": "test@subbly.co", "name": "John Doe", "country": "DE" }, "link": { "email": "test@subbly.co", "name": "John Doe" }, "cashapp": { "email": "test@subbly.co", "name": "John Doe", "buyer_id": "cashapp:123456789", "cash_tag": "$subbly" }, "created_at": "2022-04-01T00:00:00.000000Z" }

Get payment method by ID

GET /payment_methods/{payment_method_id}

A detailed description of the payment method. expand[]: Accepted for consistency with other endpoints; the payment method has no expandable relations.

Path parameters

payment_method_idRequiredinteger

Payment method ID

Format: integer.

Query parameters

expand[]optionalstring[]

List of relations to expand in the response. Each expandable field on the response schema names its key, e.g. expand[]=customer. Nested keys use dot notation, e.g. items.product or subscriptions.items. Fields marked as always present are returned without being requested. An expanded list is null, not [], when there are no records. Unknown keys are ignored unless the endpoint says otherwise.

ReturnsPaymentMethod

Payment method object response

Error responses

400object

The payment method belongs to another shop.

404object

The payment method does not exist or has been deleted.

curl https://api.subbly.co/private/v1/payment_methods/{payment_method_id} \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 567, "type": "card", "identifier": "4242", "currencies": [ "USD", "EUR" ], "card": { "last_four": "4242", "expiry_month": "2", "expiry_year": "2099", "type": "credit", "brand": "visa" }, "ideal": { "bank": "ING", "bic": "INGBNL2A", "email": "test@subbly.co", "name": "John Doe" }, "bancontact": { "email": "test@subbly.co", "name": "John Doe" }, "acss_debit": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "Royal Bank of Canada", "transit_number": "12345", "institution_number": "123", "last_four": "6789" }, "us_bank_account": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "US Bank", "last4": "6789", "routing_number": "123456789", "account_type": "checking", "account_holder_type": "individual" }, "sepa_debit": { "email": "test@subbly.co", "name": "John Doe", "iban_last4": "6789", "bank_code": "123456", "country": "DE", "branch_code": "12345" }, "sofort": { "email": "test@subbly.co", "name": "John Doe", "country": "DE" }, "link": { "email": "test@subbly.co", "name": "John Doe" }, "cashapp": { "email": "test@subbly.co", "name": "John Doe", "buyer_id": "cashapp:123456789", "cash_tag": "$subbly" }, "created_at": "2022-04-01T00:00:00.000000Z" }

Delete a payment method

DELETE /payment_methods/{payment_method_id}

Remove a stored payment method and detach it at the gateway. When it was the customer's default payment method, the default is cleared as well. The payment method must belong to your shop.

Path parameters

payment_method_idRequiredinteger

Payment method ID

Format: integer.

ReturnsPaymentMethod

The deleted payment method

Error responses

404object

The payment method does not exist or belongs to another shop.

curl -X DELETE https://api.subbly.co/private/v1/payment_methods/{payment_method_id} \ -H 'X-API-KEY: <api-key>'
Response
{ "id": 567, "type": "card", "identifier": "4242", "currencies": [ "USD", "EUR" ], "card": { "last_four": "4242", "expiry_month": "2", "expiry_year": "2099", "type": "credit", "brand": "visa" }, "ideal": { "bank": "ING", "bic": "INGBNL2A", "email": "test@subbly.co", "name": "John Doe" }, "bancontact": { "email": "test@subbly.co", "name": "John Doe" }, "acss_debit": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "Royal Bank of Canada", "transit_number": "12345", "institution_number": "123", "last_four": "6789" }, "us_bank_account": { "email": "test@subbly.co", "name": "John Doe", "bank_name": "US Bank", "last4": "6789", "routing_number": "123456789", "account_type": "checking", "account_holder_type": "individual" }, "sepa_debit": { "email": "test@subbly.co", "name": "John Doe", "iban_last4": "6789", "bank_code": "123456", "country": "DE", "branch_code": "12345" }, "sofort": { "email": "test@subbly.co", "name": "John Doe", "country": "DE" }, "link": { "email": "test@subbly.co", "name": "John Doe" }, "cashapp": { "email": "test@subbly.co", "name": "John Doe", "buyer_id": "cashapp:123456789", "cash_tag": "$subbly" }, "created_at": "2022-04-01T00:00:00.000000Z" }
idinteger
typestring

Possible values: paypal, card, ideal, sofort, bancontact, sepa_debit, acss_debit, us_bank_account, link, cashapp, amazon_pay.

identifierstring | null
currenciesstring[]

Codes of the currencies the payment method can be charged in โ€” the shop currencies attached to its gateway. A subscription created with this payment method must bill in one of them.

cardobject | null

Only applicable for the card type

idealobject | null

Only applicable for the ideal type

bancontactobject | null

Only applicable for the bancontact type

acss_debitobject | null

Only applicable for the acss_debit type

us_bank_accountobject | null

Only applicable for the us_bank_account type

sepa_debitobject | null

Only applicable for the sepa_debit type

sofortobject | null

Only applicable for the sofort type

linkobject | null

Only applicable for the link type

cashappobject | null

Only applicable for the cashapp type

created_atstring | null

Format: date-time.

idinteger
typestring

Possible values: paypal, card, ideal, sofort, bancontact, sepa_debit, acss_debit, us_bank_account, link, cashapp, amazon_pay.

identifierstring | null
currenciesstring[]

Codes of the currencies the payment method can be charged in โ€” the shop currencies attached to its gateway. A subscription created with this payment method must bill in one of them.

cardobject | null

Only applicable for the card type

idealobject | null

Only applicable for the ideal type

bancontactobject | null

Only applicable for the bancontact type

acss_debitobject | null

Only applicable for the acss_debit type

us_bank_accountobject | null

Only applicable for the us_bank_account type

sepa_debitobject | null

Only applicable for the sepa_debit type

sofortobject | null

Only applicable for the sofort type

linkobject | null

Only applicable for the link type

cashappobject | null

Only applicable for the cashapp type

created_atstring | null

Format: date-time.

idinteger
typestring

Possible values: paypal, card, ideal, sofort, bancontact, sepa_debit, acss_debit, us_bank_account, link, cashapp, amazon_pay.

identifierstring | null
currenciesstring[]

Codes of the currencies the payment method can be charged in โ€” the shop currencies attached to its gateway. A subscription created with this payment method must bill in one of them.

cardobject | null

Only applicable for the card type

idealobject | null

Only applicable for the ideal type

bancontactobject | null

Only applicable for the bancontact type

acss_debitobject | null

Only applicable for the acss_debit type

us_bank_accountobject | null

Only applicable for the us_bank_account type

sepa_debitobject | null

Only applicable for the sepa_debit type

sofortobject | null

Only applicable for the sofort type

linkobject | null

Only applicable for the link type

cashappobject | null

Only applicable for the cashapp type

created_atstring | null

Format: date-time.