Create customer payment method switch
1 min
POST
https://app.amberflo.io/customers/payment-method/switch
Body Parameters
- bodycustomer.payment_method.CustomerPaymentMethodSwitch.inDescription
- customerIdstringrequiredDescription
- sourcePaymentTypecustomer.payment_method.BillingSystem.inDescription
- sourcePaymentIdstringDescription
- targetPaymentTypecustomer.payment_method.BillingSystem.inrequiredDescription
- targetPaymentIdstringrequiredDescription
- targetCustomerIdentifierstringrequiredDescription
- switchTimeInSecondsinteger<int64>requiredDescription
Responses
200
- customer.payment_method.CustomerPaymentMethodSwitch.outDescription
- customerIdstringrequiredDescription
- sourcePaymentTypecustomer.payment_method.BillingSystem.inDescription
- sourcePaymentIdstringDescription
- targetPaymentTypecustomer.payment_method.BillingSystem.inrequiredDescription
- targetPaymentIdstringrequiredDescription
- targetCustomerIdentifierstringrequiredDescription
- switchTimeInSecondsinteger<int64>requiredDescription
- createdTimeInSecondsinteger<int64>Description
- updatedTimeInSecondsinteger<int64>Description
400
401
403
404
409
500
curl
curl --request POST \
--url https://app.amberflo.io/customers/payment-method/switch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"customerId": "",
"targetPaymentType": "",
"targetPaymentId": "",
"targetCustomerIdentifier": "",
"switchTimeInSeconds": 0
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"customerId": "",
"targetPaymentType": "",
"targetPaymentId": "",
"targetCustomerIdentifier": "",
"switchTimeInSeconds": 0
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/customers/payment-method/switch", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://app.amberflo.io/customers/payment-method/switch")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"customerId": "",
"targetPaymentType": "",
"targetPaymentId": "",
"targetCustomerIdentifier": "",
"switchTimeInSeconds": 0
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/customers/payment-method/switch"
payload = json.dumps({
"customerId": "",
"targetPaymentType": "",
"targetPaymentId": "",
"targetCustomerIdentifier": "",
"switchTimeInSeconds": 0
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successfully created payment method switch with confirmation details and effective timing
{
"customerId": "",
"sourcePaymentType": "",
"sourcePaymentId": "",
"targetPaymentType": "",
"targetPaymentId": "",
"targetCustomerIdentifier": "",
"switchTimeInSeconds": "",
"createdTimeInSeconds": "",
"updatedTimeInSeconds": ""
}400
// Invalid switch configuration, unsupported payment provider, or malformed request body
401
// Authentication required or invalid API key provided
403
// Insufficient permissions to modify customer payment methods
404
// Customer not found or target payment provider not configured
409
// Conflicting payment method switch already in progress for this customer
500
// Internal server error occurred while creating payment method switch