Skip to content

Instantly share code, notes, and snippets.

@jcleblanc
Created June 26, 2014 05:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcleblanc/b2abe0da1904b700c71f to your computer and use it in GitHub Desktop.
Save jcleblanc/b2abe0da1904b700c71f to your computer and use it in GitHub Desktop.
paypal_rest_subscriptions_billing_agreement
curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-plans \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {accessToken}' \
-d '{
"name": "Fruit of the Month",
"description": "10 Pound Box of Fruit",
"type": "fixed",
"payment_definitions": [
{
"name": "Standard Package",
"type": "REGULAR",
"frequency": "MONTH",
"frequency_interval": "2",
"amount": {
"value": "50",
"currency": "USD"
},
"cycles": "12",
"charge_models": [
{
"type": "SHIPPING",
"amount": {
"value": "8",
"currency": "USD"
}
},
{
"type": "TAX",
"amount": {
"value": "4",
"currency": "USD"
}
}
]
},
{
"name":"First Month Free Trial",
"type":"TRIAL",
"frequency":"MONTH",
"frequency_interval":"1",
"amount": {
"value" : "50",
"currency" : "USD"
},
"cycles":"1",
"charge_models": [
{
"type":"SHIPPING",
"amount": {
"value" :"8",
"currency" : "USD"
}
},
{
"type":"TAX",
"amount": {
"value" :"4",
"currency" : "USD"
}
}
]
}],
"merchant_preferences": {
"setup_fee": {
"value": "1",
"currency": "USD"
},
"return_url": "http://www.fruitofthemonth.com/complete",
"cancel_url": "http://www.fruitofthemonth.com/cancel",
"autobill_amount": "YES",
"initial_amount_fail_action": "CONTINUE",
"max_fail_attempts": "0"
}
}'
@MartyIX
Copy link

MartyIX commented Oct 29, 2014

The line 41 contains "amount": { and the line 44 contains closing bracket that should be lower in the JSON.

The first month should a free trial but the snippet indicate that the first month is not really free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment