POST
/
payment-methods
curl -X POST \
 /payment-methods \
 --header "Content-Type: application/json" \
 --header "Authorization: Bearer <token>" \
 --data '{
    "summary": "Create stripe setup intent",
    "description": "The stripe setup intent clientSecret is required to add a stripe credit card payment method. The clientSecret is required to collect credit card data with stripe.js elements.",
    "value": {
        "gateway": "stripe",
        "type": "card",
        "customerId": "ad8f7a8d-8f7a-8d8f-7a8d8f7a8d8f",
        "isDefault": true,
        "futureUsageAllowed": true,
        "stripe": {
            "paymentMethodId": null,
            "customerId": null
        }
    }
}'

Authorizations

Authorization
string
headerrequired

Value for the Authorization header parameter.

Body

gateway
enum<string> | null
required

The payment gateway to use to process the given payment method type

Possible values:

  • paypal: PayPal (supports "paypal")
  • stripe: Stripe (supports "card")
  • testing: Testing (supports all)
  • go_cardless: GoCardless (supports "sepa_debit")
  • bank_transfer: Bank Transfer (supports "bank_transfer")
  • sepa_debit: SEPA Credit and Debit with xml file (supports "sepa_debit")
  • wallet: Credit Balance from Wallet (supports "wallet")
Available options:
wallet,
sepa_debit,
stripe,
fake_provider,
paypal,
bank_transfer,
go_cardless,
testing
type
enum<string> | null
required

The payment method type to use for this payment method

Possible values:

  • sepa_debit: SEPA Debit
  • card: Credit Card
  • paypal: PayPal
  • bank_transfer: Bank Transfer
  • wallet: Wallet
Available options:
sepa_debit,
card,
paypal,
bank_transfer,
wallet,
fake_provider
customerId
string | null
required

The customer that owns this payment method. If not provided, the customer will be determined by the authenticated user.

isDefault
boolean
default: true

Determines if this payment method should be used as default payment method for the customer

futureUsageAllowed
boolean
default: true

Determines if this payment method is allowed to be used for future payments. Otherwise the payment method is only available for this payment.

stripe
object

Required when gateway is "stripe". Holds all necessary data for the payment gateway to create the payment method.

sepaMandate
object

Required when gateway is "sepa_debit". Holds all necessary data for the payment gateway to create the payment method.

goCardless
object

Optional for gateway "go_cardless". It is only required when you want to migrate, or assign an existing GoCardless customer or mandate to fynn.

redirectUrl
string | null

The redirect url to redirect the customer to after the payment method was created. This is only required, when you create a payment method with your own flow, independent from provided Hosted-Checkout, Hosted-Customerfront or Fynn.JS. Otherwise this has no effect.

Response

201 - application/json
status
enum<string>

Possible values:

  • action_required: The payment method requires an action to be taken by the customer
  • success: The payment method was successfully created
  • failed: The payment method could not be created
Available options:
action_required,
success,
failed
actionRequired
object | null

The action required if the payment method requires an action to be taken by the customer

  • redirect_to_gateway: The customer needs to be redirected to the payment gateway
  • client_site_action: The customer needs to take an action on the client site
failReason
string | null

The fail reason if status is failed

paymentMethod
object

The created payment method, if status is success