In my rails app I am using balanced payments api for credit card transactions. According to the documentation after I collect the info I must run these curl commands. However, I cant figure out what's what. So I can't really use it because I don't know what variables to replace and how to even get them. This is a snippet of their documentation.

Let's charge the card:

First, let's create an account to associate the card token with:

curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0/accounts \
     -u df6000d8f2ec11e294cf026ba7cd33d0: \
     -d "card_uri=/v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0/cards/CCwpuGSqIjnOxUoUrSE4IdV"

Associate the token with an account:

curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0/accounts/AC6VSiS3WD7G1z1BjrMIL4Kk \
     -u df6000d8f2ec11e294cf026ba7cd33d0: \
     -X PUT \
     -d "card_uri=/v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0/cards/CC6XpIuz7jymGcPIkCREtx2K"

Debit the account:

curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0/accounts/ACwPcWVArKDYEdOJ8bRHg9w/debits \
     -u df6000d8f2ec11e294cf026ba7cd33d0: \
     -d "amount=1000"

So I can understand that /v1/marketplaces/TEST-MP6NFmfjuy4Os0LSSywJbmk0 is my test marketplace URI but what are these other values?

df6000d8f2ec11e294cf026ba7cd33d0

CCwpuGSqIjnOxUoUrSE4IdV

AC6VSiS3WD7G1z1BjrMIL4Kk

Any thoughts would be appreciated. Thanks!

有帮助吗?

解决方案

Have you considered using the balanced ruby client?

https://github.com/balanced/balanced-ruby

https://docs.balancedpayments.com/current/api.html?language=ruby

Also, I believe they have an example marketplace Rails app: https://github.com/balanced/rentmybikes-rails

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top