Billing - Customers
Switching Payment Providers
Create customer payment method switch
1 min
code examples curl location 'https //app amberflo io/customers/payment method/switch' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "customerid" "", "targetpaymenttype" "", "targetpaymentid" "", "targetcustomeridentifier" "", "switchtimeinseconds" 0 }'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));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 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) responses // successfully created payment method switch with confirmation details and effective timing { "customerid" "", "sourcepaymenttype" "", "sourcepaymentid" "", "targetpaymenttype" "", "targetpaymentid" "", "targetcustomeridentifier" "", "switchtimeinseconds" "", "createdtimeinseconds" "", "updatedtimeinseconds" "" }// invalid switch configuration, unsupported payment provider, or malformed request body // authentication required or invalid api key provided // insufficient permissions to modify customer payment methods // customer not found or target payment provider not configured // conflicting payment method switch already in progress for this customer // internal server error occurred while creating payment method switch
