# Safety Pay (Ecuador)

> Learn how to use Safety Pay as one of your payment methods in Ecuador with EBANX Direct API.

# Safety Pay

Safety Pay is an alternative payment method supported by EBANX, designed to offer secure, real-time transactions across Latin America. It allows customers to make online purchases using bank transfers or cash payments without the need for credit or debit cards. By selecting Safety Pay, customers are redirected to their bank’s platform or a nearby payment location to complete the transaction, making it ideal for users who prefer secure and accessible payment options. This method is particularly popular in countries where traditional banking access is limited, providing merchants with a way to reach a broader audience through EBANX’s integrated platform.

## Requirements

- **API authentication** - All API requests must be authenticated using [JWS (JSON Web Signature)](/docs/get-started/api-authentication/jws-authentication). The legacy `integration_key` is being deprecated — if you still use it, follow the [Migration Guide](/docs/get-started/api-authentication/jws-migration) to transition to JWS. If you don't have credentials yet, complete the [Merchant Signup Form](https://www.ebanx.com/en/contact/).
- **Familiarity with EBANX Direct** - This setup follows the same general structure as other payment methods, with a few unique parameters.

## How it works

- **Select Safety Pay at checkout** - Your customer chooses Safety Pay as their payment method during checkout.
- **Generate payment code** - EBANX creates a unique payment code or link associated with the transaction.
- **Redirect customer** - Your customer is redirected to their bank’s online banking platform or given details for an offline payment location.
- **Complete payment** - Your customer completes the payment via bank transfer or cash payment at an affiliated location.
- **Confirm transaction** - Once the payment is made, Safety Pay notifies EBANX, updating the transaction status so that you can fulfill the order.

## Instructions

Follow the steps below.

### Select your environment
Select the appropriate environment for your integration. Use the sandbox environment for testing, or the production environment for live transactions. Use the URL for your HTTP requests based on your selection.

- **Cross-border sandbox:** `https://sandbox.ebanxpay.com/ws/direct`
- **Cross-border production:** `https://api.ebanxpay.com/ws/direct`
- **Local sandbox:** `https://sandbox-local-latam.ebanxpay.com/ws/direct`
- **Local production:** `https://api-local-latam.ebanxpay.com/ws/direct`

Check the method's availability for your country and tenant in [Payment Methods by Country](/docs/pay-in/processing/payment-methods/payment-methods-overview#payment-methods-by-country). Questions about tenant and environment? Check our [API Operability](/docs/get-started/api-operability) and [API Endpoints](/docs/get-started/api-endpoints).

### Define your parameters

With **Safety Pay**, customers are redirected to a secure third-party website to complete the payment quickly and safely. To obtain this redirection link, call the **/ws/direct** endpoint with the required parameters.

  At the API Reference Guide, select Ecuador and Safety Pay from
  the dropdown menus.

### Sample request

Use the following example to initiate a request.

```bash
curl -X POST \
  --location 'https://sandbox.ebanxpay.com/ws/direct' \
  --header 'Content-Type: application/json' \
  --data '{
    "integration_key": "{{integration_key}}",
    "payment": {
        "name": "John Doe",
        "email": "john.doe@example.com",
        "document": "{{tax_id}}",
        "phone_number": "5555555555",
        "country": "ec",
        "payment_type_code": "safetypay-cash",
        "merchant_payment_code": "{{unique_merchant_code}}",
        "currency_code": "USD",
        "amount_total": 99.85
    }
}'
```

### Sample response

A successful request returns a response like the example below, with the third-party website link provided in the **payment.redirect_url** parameter.

```json
{
  "redirect_url": "{{redirect_url}}",
  "payment": {
    "hash": "59acc5f00945fa382ab051651440826da7701533249b3a475",
    "country": "ec",
    "merchant_payment_code": "{{unique_merchant_code}}",
    "status": "PE",
    "status_date": "{{YYYY-MM-DD HH:mm:ss}}",
    "open_date": "{{YYYY-MM-DD HH:mm:ss}}",
    "confirm_date": null,
    "transfer_date": null,
    "amount_br": "99.85",
    "amount_ext": "99.85",
    "amount_iof": "1",
    "currency_rate": "1",
    "currency_ext": "USD",
    "due_date": "{{YYYY-MM-DD}}",
    "instalments": "1",
    "payment_type_code": "safetypay-cash",
    "pre_approved": false,
    "redirect_url": "{{redirect_url}}"
  },
  "status": "SUCCESS"
}
```

[Merchant Area](https://dashboard.ebanx.com)

### Redirect customer to the returned URL

Redirect your customer to the URL returned in the parameter `redirect_url`. After the redirection, your customer will be in a third-party website, with all the necessary purchase details to finalize their payment securely.

#### **Testing Safety Pay in a sandbox environment**

In our Sandbox environment, we provide a Safety Pay simulation interface to test bank transfer payments. This mock interface allows you to simulate different payment outcomes:

- Simulate Authorized = YES: Confirms the payment as successful.
- Simulate Authorized = NO: Denies the payment.
- Leave Pending: Leaves the payment in a pending state.

This simulation mimics the real production flow, where users are redirected to their Internet Banking to complete transactions, enabling you to thoroughly test authorized and unauthorized payments.

![Safety Pay sandbox authorization interface with payment simulation options](/img/docs/pay-in/processing/payment-methods/country-specific/ecuador/safetypay-authorization-sandbox.png)

### Monitor payment for status changes

**Notifications**

- EBANX will send a notification whenever a payment status changes.

- Make sure your system is set up to receive notifications from EBANX for any changes in payment status.

- [Learn more about Payment Notifications](/docs/pay-in/management/status-and-retrieval/payment-notifications)

**Status**

- After receiving a notification that status has changed, retrieve the payment status.

- When a payment is confirmed, the status will change from **pending (PE)** to **confirmed (CO)**.
  If the customer does not complete the payment, the status will eventually change to **cancelled (CA)**.

- [Learn more about Retrieving Payment Status](/docs/pay-in/management/status-and-retrieval/retrieve-payment)

### Congratulations!

You have successfully integrated **Safety Pay**.

For more information, refer to the [Direct API reference guide](/api-reference?api=pay-in&page=direct)

## Resources

Use the following resources when testing in your sandbox environment.
- [Sample Cards](/docs/pay-in/dev-tools/sandbox-simulation/test-credit-cards)
- [API Reference](/api-reference)
- [Mock Customer Data](/docs/pay-in/dev-tools/sandbox-simulation/test-customer-data)
- [Error Codes](/docs/pay-in/dev-tools/response-codes/api-error-codes)
## Still need help?

If you still have questions, you can explore the following options:

- **Merchant support:** Contact our support team at [sales.engineering@ebanx.com](mailto:sales.engineering@ebanx.com) for assistance.
- **Not a partner yet?** Complete the [Merchant Signup Form](https://business.ebanx.com/en/request-contact), and our commercial team will reach out to you.
