# Ready to pay

Retrieves available payment methods for a specific transaction or purchase.
The order in which the payment methods are displayed to the customer should be the same as the order in the response.
The list of payment methods is generated from available gateway accounts and the last matched `adjust-ready-to-pay` action on the `ready-to-pay-requested` event.
If no rules match for the specific request, all methods supported by the gateway accounts are sent.
To invert this behavior, place an all matching rule at the end of the `ready-to-pay-requested` event in the rules engine,
and include an empty `paymentMethods` property for the `adjust-ready-to-pay` action.
For more information, see [Update event rules](https://www.rebilly.com/catalog/all/rules#operation/PutEventRule) and [Gateway accounts](https://www.rebilly.com/catalog/all/gateway-accounts).

Endpoint: POST /ready-to-pay
Version: latest
Security: SecretApiKey, JWT

## Security:

  - `SecretApiKey` (unknown)
    apiKey in header REB-APIKEY

  - `JWT` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `customerId` (string)
    ID of the customer resource.
    Example: cus_0YV7DDSDD1C8DA64KHH2W33CPF

  - `websiteId` (string, required)
    ID of the website.
A website is where an organization obtains a customer.
For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id).
    Example: web_0YV7DE4Z26DQSA1AC92FBJ7SEG

  - `currency` (string, required)
    Currency code in ISO 4217 format.
    Example: USD

  - `amount` (number, required)
    Amount to pay.

  - `billingAddress` (object)
    Contact's information.

  - `billingAddress.firstName` (string | null)
    Contact's first name.
    Example: Benjamin

  - `billingAddress.lastName` (string | null)
    Contact's last name.
    Example: Franklin

  - `billingAddress.organization` (string | null)
    Contact's organization.
    Example: Rebilly

  - `billingAddress.address` (string | null)
    First line of the contact's street address.
    Example: 36 Craven St

  - `billingAddress.address2` (string | null)
    Second line of the contact's street address.

  - `billingAddress.city` (string | null)
    Contact's city of residence.
    Example: Austin

  - `billingAddress.region` (string | null)
    Contact's region of residence.
    Example: Texas

  - `billingAddress.country` (string | null)
    Contact's country of residence in ISO 3166 alpha-2 country code.
For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/).
    Example: GB

  - `billingAddress.postalCode` (string | null)
    Contact's postal code.
    Example: WC2N 5NF

  - `billingAddress.phoneNumbers` (array)
    List of phone numbers associated with the contact.

  - `billingAddress.phoneNumbers.label` (string, required)
    Phone number label or name.
    Example: main

  - `billingAddress.phoneNumbers.value` (string, required)
    Phone number value.
    Example: 1-512-777-0269

  - `billingAddress.phoneNumbers.primary` (boolean)
    Specifies if the phone number is the contact's primary phone number.
    Example: true

  - `billingAddress.emails` (array)
    List of email addresses associated with the contact.

  - `billingAddress.emails.label` (string, required)
    Email label or name.
    Example: main

  - `billingAddress.emails.value` (string, required)
    Email address value.
    Example: rebilly@example.com

  - `billingAddress.emails.primary` (boolean)
    Specifies if the email address is the contact's primary email address.
    Example: true

  - `billingAddress.dob` (string | null)
    Contact's date of birth in ISO-8601 `YYYY-MM-DD` format.
    Example: 1980-04-01

  - `billingAddress.jobTitle` (string | null)
    Contact's job title.
    Example: CEO

  - `riskMetadata` (object, required)
    Risk metadata used for 3D Secure and risk scoring.

  - `riskMetadata.ipAddress` (string | null)
    Customer's IP address.
    Example: 93.92.91.90

  - `riskMetadata.fingerprint` (string | null)
    Customer's device fingerprint.
A device fingerprint is a unique token that is used to identify the customer.
The device fingerprint is generated based on device attributes, such as: hardware,
software, IP address, language, browser, and more.
    Example: pIUt3xbgX3l9g3YDiLbx

  - `riskMetadata.httpHeaders` (any)

  - `riskMetadata.browserData` (object | null)
    Browser data used for 3D Secure and risk scoring.

  - `riskMetadata.browserData.colorDepth` (integer, required)
    Browser color depth in bits per pixel.
This value is obtained using the `screen.colorDepth` property.
    Example: 24

  - `riskMetadata.browserData.isJavaEnabled` (boolean, required)
    Specifies if Java is enabled in a browser.
This value is obtained from the `navigator.javaEnabled` property.

  - `riskMetadata.browserData.language` (string, required)
    Browser language settings.
This value is obtained from the `navigator.language` property.
    Example: en-US

  - `riskMetadata.browserData.screenWidth` (integer, required)
    Width of the browser screen.
This value is obtained from the `screen.width` property.
    Example: 1920

  - `riskMetadata.browserData.screenHeight` (integer, required)
    Height of the browser screen.
This value is obtained from the `screen.height` property.
    Example: 1080

  - `riskMetadata.browserData.timeZoneOffset` (integer, required)
    Browser time zone offset in minutes from UTC.
A positive offset indicates that the local time is behind UTC.
A negative offset indicates that the local time is ahead of UTC.
You can find this value using the `(new Date()).getTimezoneOffset()` property.
    Example: 300

  - `riskMetadata.browserData.isAdBlockEnabled` (boolean)
    Specifies if the usage of ad block has been detected in the browser.

  - `riskMetadata.extraData` (object | null)
    Third-party data used for risk scoring.

  - `riskMetadata.extraData.kountFraudSessionId` (string)
    Alpha-numeric `fraudSessionId` as provided by the Kount SDK.
    Example: abcdefg12345abababab123456789012

  - `riskMetadata.extraData.payPalMerchantSessionId` (string)
    PayPal `MerchantSessionID` as generated by the PayPal Fraudnet SDK.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowa

  - `riskMetadata.extraData.threatMetrixSessionId` (string)
    Temporary identifier that is unique to the visitor session and passed to ThreatMetrix.
    Example: dd65ratxc5qv15iph3vyoq7l6davuowadd65ratxc5qv15iph3vyoq7l6davuowa

  - `items` (array, required)

  - `items.planId` (string, required)
    ID of the plan.
    Example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X

  - `items.quantity` (integer, required)
    Number of product units in the specified plan.

## Response 200:

  - `200` (unknown)
    Payment methods retrieved.

## Response 200 fields (application/json):

  - `method` (string, required)
    Payment method.
    Enum: "payment-card"

  - `feature` (any)
    Specific feature of this method.
For example, a digital wallet.
If the method does not have any features, this value is null.

  - `feature.name` (string)
    Name of the feature.
    Enum: "Apple Pay"

  - `feature.displayName` (string)
    String of 64 or fewer UTF-8 characters containing the canonical name for your store,
that is suitable for display.
Do not localize the name.
    Example: Test Merchant

  - `feature.country` (string)
    ISO 3166 alpha-2 country code where the payment is processed.
This is often the location for settling the payment.
Consult with your Payment Service Provider (PSP) to determine the
appropriate country code.
    Example: US

  - `feature.merchantName` (string)
    Merchant name in Google Pay.
    Example: Test Merchant

  - `feature.merchantOrigin` (string)
    Merchant origin in Google Pay.
The fully qualified domain name.
    Example: www.example.com

  - `feature.merchantName` (string)
    Merchant name in Samsung Pay.
    Example: Test Merchant

  - `brands` (array)
    List of supported brands.

  - `filters` (array)
    For the method to be applicable, one or more of the following filters must match.
If no filters are sent, no restrictions are applied.
For more information, see [Using filters](https://www.rebilly.com/docs/dev-docs/search-filters).

  - `feature` (any)
    Specific feature of this method.
For example, a digital wallet or a processor.
If the method does not have any features, this value is null.

  - `feature.linkToken` (string, required)
    Plaid `linkToken` for frontend integrations.

  - `feature.expirationTime` (string, required)
    Date and time when the `linkToken` expires.

  - `feature` (any)
    Specific features of PayPal.

  - `feature.paypalMerchantId` (string, required)
    ID of the PayPal merchant.

  - `feature.paypalClientId` (string, required)
    ID of the PayPal client.

  - `feature.billingAgreementToken` (string, required)
    PayPal billing agreement token.

  - `feature.expirationTime` (string, required)
    Date and time when the billing agreement token expires.

## Response 200 headers (application/json):

  - `X-RateLimit-Limit` (integer)
    Total number of rate limit tokens for this request within a rate limit period.
For more information, see [Rate limits](#section/Rate-limits).
    Example: 3600

  - `X-RateLimit-Remaining` (integer)
    Remaining number of rate limit tokens for this request within the rate limit period. 
For example, in the sandbox environment, rate limits for non-GET endpoints are set at 3000 requests per 10 minutes.
    Example: 3600

## Response 401:

  - `401` (unknown)
    Unauthorized access.
Invalid credentials used.

## Response 401 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `type` (string)
    Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".

  - `title` (string)
    Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.

  - `detail` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 403:

  - `403` (unknown)
    Access forbidden.

## Response 403 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `type` (string)
    Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".

  - `title` (string)
    Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.

  - `detail` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 422:

  - `422` (unknown)
    Invalid data sent.

## Response 422 fields (application/json):

  - `status` (integer)
    HTTP status code.

  - `type` (string)
    Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".

  - `title` (string)
    Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.

  - `detail` (string)
    Human-readable explanation that is specific to this occurrence of the problem.

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

  - `invalidFields` (array)
    Invalid field details.
    Example: [{"field":"field1","message":"field1 is invalid"},{"field":"subObject.field2","message":"field2 is invalid"},{"field":"subObject.field2","message":"another error in the field2"}]

  - `invalidFields.field` (string)
    Name of the field.
Dot notation is used for nested object field names.

  - `invalidFields.message` (string)
    Message field.

## Response 429:

  - `429` (unknown)
    Request rate limit exceeded.

## Response 429 fields (application/json):

  - `type` (string)
    Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference.
It should provide human-readable documentation for the problem type.
When this member is not present, its value is assumed to be "about:blank".
    Example: about:blank

  - `title` (string)
    Short, human-readable summary of the problem type.
Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem.
    Example: Rate Limit Exceeded

  - `status` (integer)
    HTTP status code.

  - `detail` (string)
    Human-readable explanation that is specific to this occurrence of the problem.
    Example: A request cannot be executed because the user has sent too many requests within a certain period of time

  - `instance` (string)
    URI reference that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.

## Response 429 headers (application/json):

  - `X-RateLimit-Retry-After` (integer)
    UTC timestamp after which the rate limit resets and the request can be retried.
    Example: 1713187500

