On this page
No Headings
Oauth 2.0 authentication
Client CredentialsToken URLhttps://api-m.paypal.com/v1/oauth2/tokenInheaderScopes
https://uri.paypal.com/services/subscriptionsapplication/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
curl -X POST "https://api-m.paypal.com/v1/payments/billing-agreements" \ -H "Content-Type: application/json" \ -d '{ "name": "Direct Payment Recurring Profile", "description": "Credit card payment", "start_date": "2016-12-23T08:00:00Z", "plan": { "id": "P-2PL786081D358645F6NWEKFQ" }, "payer": { "payment_method": "credit_card", "payer_info": { "email": "johndoe@example.com" }, "funding_instruments": [ { "credit_card": { "type": "visa", "number": "4417119664863864", "expire_month": 12, "expire_year": 2021, "cvv2": 111, "billing_address": { "line1": "065769 Holcomb Bridge Road #141", "line2": "5713 E Dimond Boulevard #B9", "city": "Wichita", "state": "KS", "postal_code": "67202", "country_code": "US" } } } ] } }'{
"id": "string",
"state": "Pending",
"name": "string",
"description": "string",
"start_date": "2019-08-24T14:15:22Z",
"agreement_details": {
"cycles_remaining": "string",
"cycles_completed": "string",
"next_billing_date": "string",
"last_payment_date": "string",
"final_payment_date": "string",
"failed_payment_count": "string",
"outstanding_balance": {
"value": "string",
"currency": {}
},
"last_payment_amount": {
"value": "string",
"currency": {}
}
},
"payer": {
"payment_method": "bank",
"funding_instruments": [
{
"credit_card": {
"id": "string",
"number": "string",
"type": "string",
"expire_month": 0,
"expire_year": 0,
"cvv2": 0,
"first_name": "string",
"last_name": "string",
"external_customer_id": "string",
"state": "expired",
"valid_until": "string",
"links": [
{
"href": "string",
"rel": "string",
"method": "GET"
}
],
"billing_address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country_code": "st",
"postal_code": "string"
}
}
}
],
"funding_option_id": "string",
"payer_info": {
"email": "user@example.com",
"first_name": "string",
"last_name": "string",
"payer_id": "string",
"shipping_address": {
"recipient_name": "string",
"default_address": true,
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country_code": "st",
"postal_code": "string"
},
"billing_address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country_code": "st",
"postal_code": "string"
}
}
},
"override_merchant_preferences": {
"id": "string",
"cancel_url": "http://example.com",
"return_url": "http://example.com",
"max_fail_attempts": "string",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"accepted_payment_type": "string",
"char_set": "string",
"setup_fee": {
"value": "string",
"currency": {}
}
},
"override_charge_models": [
{
"charge_id": "string",
"amount": {
"value": "string",
"currency": {}
}
}
],
"plan": {
"id": "string",
"name": "string",
"description": "string",
"type": "FIXED",
"state": "CREATED",
"create_time": "string",
"update_time": "string",
"payment_definitions": [
{
"id": "string",
"name": "string",
"type": "TRIAL",
"frequency_interval": "string",
"frequency": "string",
"cycles": "string",
"charge_models": [
{
"id": "string",
"type": "TAX",
"amount": {
"value": "string",
"currency": {}
}
}
],
"amount": {
"value": "string",
"currency": {}
}
}
],
"terms": [
{
"id": "string",
"type": "string",
"occurrences": "string",
"buyer_editable": "string",
"max_billing_amount": {
"value": "string",
"currency": {}
},
"amount_range": {
"value": "string",
"currency": {}
}
}
],
"merchant_preferences": {
"id": "string",
"cancel_url": "http://example.com",
"return_url": "http://example.com",
"max_fail_attempts": "string",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"accepted_payment_type": "string",
"char_set": "string",
"setup_fee": {
"value": "string",
"currency": {}
}
},
"links": [
{
"href": "string",
"rel": "string",
"method": "GET"
}
],
"currency_code": {}
},
"links": [
{
"href": "string",
"rel": "string",
"method": "GET"
}
],
"shipping_address": {
"line1": "string",
"line2": "string",
"city": "string",
"state": "string",
"country_code": "st",
"postal_code": "string"
}
}{
"name": "string",
"debug_id": "string",
"message": "string",
"information_link": "string",
"details": [
{
"field": "string",
"issue": "string"
}
]
}The agreement name.
length <= 128The agreement description.
length <= 128The date and time when this agreement begins, in Internet date and time format. The start date must be no less than 24 hours after the current date as the agreement can take up to 24 hours to activate.The start date and time in the create agreement request might not match the start date and time that the API returns in the execute agreement response. When you execute an agreement, the API internally converts the start date and time to the start of the day in the time zone of the merchant account. For example, the API converts a 2017-01-02T14:36:21Z start date and time for an account in the Berlin time zone (UTC + 1) to 2017-01-02T00:00:00. When the API returns this date and time in the execute agreement response, it shows the converted date and time in the UTC time zone. So, the internal 2017-01-02T00:00:00 start date and time becomes 2017-01-01T23:00:00 externally.
date-timeThe agreement details.
The details for the customer who funds the payment. The API gathers this information from execution of the approval URL.
The merchant preferences that override the default information in the plan. If you omit this parameter, the agreement uses the default merchant preferences from the plan. The merchant preferences include how much it costs to set up the agreement, the URLs where the customer can approve or cancel the agreement, the maximum number of allowed failed payment attempts, whether PayPal automatically bills the outstanding balance in the next billing cycle, and the action if the customer's initial payment fails.
An array of charge models to override the charge models in the plan. A charge model defines shipping fee and tax information. If you omit this parameter, the agreement uses the default shipping fee and tax information from the plan.
The ID of the plan on which this agreement is based.