> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rapyd

> Process card, Apple Pay and Google Pay payments through Rapyd.

Rapyd is a payment service provider that offers card acquiring and local payment methods. With Primer, you can process card, Apple Pay and Google Pay payments through Rapyd, including saved payment methods and merchant-initiated payments.

## At a glance

### Supported payment methods

| Payment method | Payment method type | Integration guide |
| - | - | - |
| Card | `PAYMENT_CARD` | [Card](https://primer.io/docs/connections/payment-methods/card/overview.md) |
| Apple Pay | `APPLE_PAY` | [Apple Pay](https://primer.io/docs/connections/payment-methods/apple-pay/overview.md) |
| Google Pay | `GOOGLE_PAY` | [Google Pay](https://primer.io/docs/connections/payment-methods/google-pay/overview.md) |

No Rapyd-specific SDK code is needed. Follow the payment method guides above.

### Supported capabilities

| Capability | Card | Apple Pay | Google Pay |
| - | - | - | - |
| Authorization and capture (separate) | Yes | Yes | Yes |
| Partial capture | Yes | Yes | Yes |
| Full and partial refunds | Yes | Yes | Yes |
| Multiple partial refunds | Yes | Yes | Yes |
| Cancel before capture | Yes | Yes | Yes |
| 3D Secure (performed by Primer) | Yes | Not applicable | Yes, for cards without a device token |
| Network tokens | Yes | Not applicable | Not applicable |
| Merchant-initiated payments (recurring and unscheduled) | Yes | Yes | Yes |
| Authorization adjustment | No | No | No |

### 3D Secure

Primer performs 3D Secure authentication using the [Perform 3DS action](https://primer.io/docs/workflows/apps/native-apps/primer-payments-app/perform-3ds-action.md) and passes the result to Rapyd. Rapyd does not run its own 3D Secure for payments processed through Primer.

## Get started with Rapyd

### Before you begin

If this is your first connection, make sure to follow the [Get started guide](https://primer.io/docs/get-started/overview.md) to begin processing payments with Primer.

You need a Rapyd sandbox account for testing and a Rapyd production account for live payments. Before you go live, ask Rapyd to enable:

* external 3D Secure (third-party MPI), if you use Primer 3DS
* payment with a network reference ID, for saved cards and merchant-initiated payments
* pre-authorization, if you capture less than the authorized amount
* Apple Pay and Google Pay with decrypted payment data, if you offer wallets

### Credentials

| Field | Where to find it |
| - | - |
| **Access key** | Rapyd Client Portal > **Developers** > **API access control** |
| **Secret key** | Rapyd Client Portal > **Developers** > **API access control** |
| **Payment method country code** | The two-letter country code of your incorporated entity (ISO 3166-1 alpha-2), for example `CY` for Cyprus. |

### Configure in the Dashboard

**1. Add Rapyd to your Dashboard**

Go to [Integrations](https://dashboard.primer.io/integrations), select **New integration**, search for Rapyd and enter your credentials.

**2. Activate the payment methods on the Checkout**

Go to [Checkout](https://dashboard.primer.io/checkout) and activate Card, Apple Pay and Google Pay.

**3. Route payments with Workflows**

In [Workflows](https://primer.io/docs/workflows/overview.md), select Rapyd in the **Authorize payment** action. Rapyd authorizes payments without capturing them, so add a **Capture payment** action, or capture later with the [Capture API](https://primer.io/docs/api-reference/v2.4/api-reference/payments-api/capture-a-payment.md).

### Prepare the client session

These fields are specific to Rapyd. Everything else follows the payment method guides.

| Parameter | Required | Description |
| - | - | - |
| `customer.firstName`, `customer.lastName` | Yes, for Apple Pay and Google Pay | Rapyd needs a cardholder name. Wallets don't provide one, so Primer sends the customer's name. Without it, Rapyd rejects the payment with `INVALID_HOLDER_NAME`. |
| `customer.billingAddress` | Recommended | Sent to Rapyd as the customer address. Needed for AVS on cards issued in the UK, US and Canada. |
| `customerId` | Yes, to save payment methods | The customer whose vault stores the payment method. |
| `paymentMethod.options.PAYMENT_CARD.captureVaultedCardCvv` | Yes, for saved cards paid by the customer | Set to `true` so the checkout asks for the CVV again when the customer pays with a saved card. |
| `paymentMethod.descriptor` | No | Sent to Rapyd as `statement_descriptor`. |
| `metadata.ewallet` | No | The Rapyd wallet ID that receives the funds. Leave it out to use your default wallet. |

Also send a cardholder name for card payments by showing the cardholder name field in your card form. Primer sends it to Rapyd as `fields.name`.

## Test in sandbox

Connect your Rapyd **test** account to your Primer Sandbox environment.

Use one of these currencies: USD, EUR, GBP, DKK, NOK, SEK, AUD, PLN, RON, CHF, JPY, CZK, HKD or CAD, with an order country in the EU, the UK or Hong Kong. Use GBP when you test 3D Secure. Use any future expiry date and any 3-digit CVV.

> [tab] Card
>
> | Card number | Network | Expected result |
> | - | - | - |
> | `4111111111111111` | Visa | Authorized |
> | `5306889942833340` | Mastercard | Authorized. If your Workflow performs 3DS: 3DS challenge (code `1234`), then Authorized |
> | `4916994064252017` | Visa | 3DS challenge (code `1234`), then Authorized |
>
> To test an error, use a card that authorizes and set one of these amounts. Primer amounts are in minor units, so 4000.00 GBP is `400000`.
>
> | Amount | `amount` in the client session | Rapyd error | Primer status |
> | - | - | - | - |
> | 4000.00 to 4009.00 | `400000` to `400900` | Gateway not responding | Failed |
> | 2000.00 to 2009.00 | `200000` to `200900` | Settlement declined | Failed |

> [tab] Apple Pay
>
> Use an Apple sandbox tester account with an [Apple Pay test card](https://developer.apple.com/apple-pay/sandbox-testing/). Send `customer.firstName` and `customer.lastName` in the client session.

> [tab] Google Pay
>
> Run Google Pay in its `TEST` environment, which returns test card data. Send `customer.firstName` and `customer.lastName` in the client session.

> [tab] Merchant-initiated
>
> | Step | Request | Expected result |
> | - | - | - |
> | 1 | Pay with `4111111111111111` or `5306889942833340`, `paymentType: FIRST_PAYMENT`, `vaultOnSuccess: true` | Authorized, payment method saved |
> | 2 | `POST /payments` with the saved token and `paymentType: UNSCHEDULED` | Authorized; Rapyd receives `initiation_type: unscheduled` and the network reference ID |
> | 3 | `POST /payments` with the saved token and `paymentType: SUBSCRIPTION` | Authorized; Rapyd receives `initiation_type: recurring` |

## Go live

Before switching to production, confirm that:

1. Your Rapyd production account is active for card, Apple Pay and Google Pay payments.
2. You have added Rapyd in your Primer **production** environment using your **production** credentials.
3. Rapyd has enabled the features you use: external 3D Secure, payment with a network reference ID, pre-authorization for partial capture, and decrypted Apple Pay and Google Pay.
4. Your Workflow captures Rapyd payments, either with a **Capture payment** action or through the Capture API.
5. You handle the [PAYMENT.STATUS webhook](https://primer.io/docs/api-reference/endpoints/v2.4/payment-webhooks/payment-status-update.md) and fulfil orders only on a final status.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.