Create source

This endpoint is deprecated and will be removed in a future version. Use the Create payment method endpoint instead.

Attach a payment source (card) to the authenticated customer from a gateway token and make it their default. Returns the customer with the new source plus a fresh JWT; setup_intent is included when the card requires extra authentication (e.g. 3D Secure).

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
🚧

Deprecated

Use the Create payment method endpoint instead. The Source endpoints will be removed in a future version.

Overview

Attach a payment source (card) to the authenticated customer from a payment-gateway token and set it as their default. On success the response is the customer (the new card appears under sources, and as the default source) plus a fresh JWT. When the card requires extra authentication (for example 3D Secure), a setup_intent is returned for your front end to complete.

Example:

curl --request POST \
  --url 'https://www.pelcro.com/api/v1/sdk/source?site_id=1232' \
  --header 'Authorization: Bearer <JWT>' \
  --header 'Content-Type: application/json' \
  --data '{ "token": "tok_visa" }'

Conditional Requirements

  • token (the gateway token) is required; omitting it returns 404.
  • A declined card returns 404 with a reason-specific message (e.g. "Sorry, your card was declined. Please try again.", "…the card has expired…", "…security code (CVC) is incorrect…").
  • A customer can store at most 200 sources; beyond that, creation returns 404.
Query Params
int32
required

The unique identifier of the site associated with your account.

Body Params
string
required

The single-use token that represents the payment method details. Typically generated using the payment gateway's tools and libraries.

string
enum
Defaults to stripe

The optional payment gateway, one of stripe, braintree, vantiv, tap or cybersource. Always defaults to stripe.

Allowed:
Responses

Language
Credentials
Query
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json