Created
July 10, 2017 20:52
-
-
Save greyson/cb5bb38ac7429766c6175714e52e6522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scenario 1: Customer is not found | |
> curl -u {PLATFORM_KEY}: https://api.stripe.com/v1/charges \ | |
-H "Stripe-Account: acct_<serviceprovider>" | |
-d amount=10000 | |
-d currency=usd | |
-d customer=cus_<customer> | |
-d source=src_<cardoncustomer> | |
-d application_fee=75 | |
{ | |
"error": { | |
"type": "invalid_request_error", | |
"message": "No such customer: cus_<customer>", | |
"param": "customer" | |
} | |
} | |
# Scenario 2: Causes application fee to also be sent to the service provider | |
> curl -u {PLATFORM_KEY}: https://api.stripe.com/v1/charges \ | |
-d amount=10000 | |
-d currency=usd | |
-d customer=cus_<customer> | |
-d source=src<cardoncustomer> | |
-d destination[account]=acct_<serviceprovider> | |
-d application_fee=75 | |
# Scenario 3: Fragile (based on hardcoded Stripe number) | |
> curl -u {PLATFORM_KEY}: https://api.stripe.com/v1/charges \ | |
-d amount=10000 | |
-d currency=usd | |
-d customer=cus_<customer> | |
-d source=src_<cardoncustomer> | |
-d destination[account]=acct_<serviceprovider> | |
-d destination[amount]=$((9710 - 75)) | |
<creates the charge with 0.75 retained with the platform> | |
# Scenario 4: Tried out of desperation | |
> curl -u {PLATFORM_KEY}: https://api.stripe.com/v1/charges \ | |
-d amount=10000 | |
-d currency=usd | |
-d customer=cus_<customer> | |
-d source=src_<cardoncustomer> | |
-d application_fee=75 | |
-d on_behalf_of=acct_<serviceprovider> | |
{ | |
"error": { | |
"type": "invalid_request_error", | |
"message": "Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).", | |
"param": "application_fee" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment