Add payment method
POST/checkout/add-payment-method
Add payment method.
Authorization Action:
pay:methods:create
Request
- application/json
Bodyrequired
cancel_urlstring
If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website.
success_urlstringrequired
The URL to which the customers is redirected when payment or setup is complete.
payment_method_typesstring[]
Possible values: [card, paypal, customer_balance]
Default value:
["card"]customerstring
ID of an existing Customer, if one exists. If blank, a new Customer object based on information provided during the payment flow will be created.
Responses
- 201
- application/json
- Schema
- Example (auto)
Schema
urlstringrequired
{
"url": "string"
}
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://connhex.com/checkout/add-payment-method");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"cancel_url\": \"string\",\n \"success_url\": \"string\",\n \"payment_method_types\": [\n \"card\"\n ],\n \"customer\": \"string\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());