# PayPal Recurring (Billing Agreement)

# Initial setup of a billing agreement via Hosted Payment Page

> 📘 Pre-conditions
>
> On the gateway side, your account must be set up with the Data Vault / Hosted Data service.
>
> Please contact PayPal to verify if your PayPal business account meets the PayPal requirements for this feature.

Besides sending the `paymentMethod` as 'paypal', you need to submit the parameter `chargetotal` with a zero value in your preauthorization request. Such transaction request is always used to create a Billing Agreement ID on the PayPal side, returned to you in the field `hostedDataId`

## Transaction Response

[block:parameters]
{
  "data": {
    "h-0": "Response parameter",
    "h-1": "Description",
    "0-0": "`approval_code`",
    "0-1": "Transaction approval code. Initial character indicates the transaction status.  \n‘Y’ – Transaction approved  \n‘N’ – Transaction declined  \n‘?:waiting PAYPAL’ – Transaction has been initiated but a final result is not yet available",
    "1-0": "`status`",
    "1-1": "Transaction status, e.g. ‘APPROVED’, ‘DECLINED’, ‘FAILED’ or ‘WAITING’",
    "2-0": "`hostedDataId`",
    "2-1": "Stores “Billing Agreement ID”",
    "3-0": "`sname`",
    "3-1": "Ship-to Name",
    "4-0": "`saddr1`",
    "4-1": "Shipping Address",
    "5-0": "`scity`",
    "5-1": "Shipping City",
    "6-0": "`scountry`",
    "6-1": "Country of Shipping Address",
    "7-0": "`szip`",
    "7-1": "Zip or Postal Code",
    "8-0": "`fail_reason`",
    "8-1": "Indicates why the transaction was declined",
    "9-0": "`ipgTransactionId`",
    "9-1": "It is mapped to the PayPal Custom. You will be able to see this value in your PayPal seller account while reviewing a transaction",
    "10-0": "`refnumber`",
    "10-1": "Represents the PayPal Transaction ID. The value will be visible in your PayPal seller account while reviewing a transaction"
  },
  "cols": 2,
  "rows": 11,
  "align": [
    "left",
    "left"
  ]
}
[/block]

# Initate a recurring PayPal transaction using the billing agreement

In order to execute a recurring or subsequent payment transaction based on the billing agreement, you need to use our RESTful payment API. Please refer to: