Storing tokens/uris returned from Balanced.js

174 Views Asked by At
  1. Currently I am storing the 'Id' value returned by Balanced.js as the card/bank account token. Then I suffix that with the API URI (/v1/marketplaces/TEST-MP5..../cards/) to charge cards. Do I need to store the entire uri returned by Balanced.js ? What are the chances that stored URI prefix (/v1/...) will be changed in the future ?

  2. What is the difference between the two end points for bank accounts? (cards seem to have only one uri: always prefixed with /v1/marketplaces..) but bank accounts - looks like you can access the via: /v1/bank_accounts/BA.... or /v1/marketplaces/TEST-.../bank_accounts/BA...

Even the documentation differs for both. Why can't they be done consistently ? https://docs.balancedpayments.com/current/api.html?language=php#adding-a-card-to-a-customer Cards are added with: $customer->addCard("/v1/marketplaces/TEST-MP.../cards/CC...")

https://docs.balancedpayments.com/current/api.html?language=php#adding-a-bank-account-to-a-customer Bank accounts are added with $customer->addBankAccount("/v1/bank_accounts/BA..")

Inconsistent documentation is confusing.. Thanks

1

There are 1 best solutions below

0
On
  1. You should always store the entire URI, constructing your own URI from the ID can lead to conflicts with future API revisions.

  2. There's no difference between the bank accounts. You may retrieve bank accounts from those endpoints. They will both result in the same bank accounts. There's some slight usability difference in both of them, but they're the same resource.