API – Set Payment Account to Primary

General

When customers have multiple payment profiles set up, one of them will need to be set as the primary profile. This can be achieved with the Customer Manager tool in the UI; but it can also be achieved through the API, which this article will explain.

Send a PUT request to the following URL:

 PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers(37)
Make sure to replace 37 with the ID of the customer for which you are changing the primary payment profile.

Payload:

{    
"id":"37", 
"PaymentAccounts":{       
"results":[         
{             
"id":1059,           
"isPrimary": 0,           
"isSecondary": 0,           
"__id":1059,           
"__update":true       
},       
{             
"id":312,           
"isPrimary": 1,           
"isSecondary": 0,           
"__id":312,           
"__update":true       
}     

}, 
"__update":true, 
"__id": 37
}

It is important to ensure that the first payment account listed under "results" is the one that is currently set as primary (or secondary, if you are updating the secondary payment profile). The payload should set the first payment profile to no longer be the primary (or secondary). The system will first remove this as primary (or secondary) and then update the second account in the payload to make it the primary (or secondary) payment profile.

The return from the PUT request will not reflect the change. You will need to submit a GET to https://loanpro.simnang.com/api/public/api/1/odata.svc/Customers({ID})?$expand=PaymentAccounts to see a response that correctly shows the new primary payment method.


How did we do?


Powered by HelpDocs (opens in a new tab)