---
description: Cómo utilizar Efecty para realizar un payin en Colombia.
---

# Efecty

## Payin por Efecty

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/pay`

Este endpoint te permite usar Efecty para realizar un payin en Colombia.

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json; chartset=UTF-8           |
| Authorization<mark style="color:red;">\*</mark> | string | Basic Base($app\__id:$security\__&#x6B;ey) |

#### Request Body

| Name                                                       | Type   | Description                                                               |
| ---------------------------------------------------------- | ------ | ------------------------------------------------------------------------- |
| app\_id<mark style="color:red;">\*</mark>                  | string | <p>Id de app creado en dashboard</p><p>- Max. 32 chars -</p>              |
| customer.phone<mark style="color:red;">\*</mark>           | string | Teléfono de usuario                                                       |
| customer.email<mark style="color:red;">\*</mark>           | string | Correo de usuario                                                         |
| customer.identify.number<mark style="color:red;">\*</mark> | string | <p>Número de identificación de usuario</p><p>- 9 digitos -</p>            |
| method<mark style="color:red;">\*</mark>                   | string | Valor fijo: Efecty                                                        |
| out\_trade\_no<mark style="color:red;">\*</mark>           | string | <p>ID dado por el merchant en su sistema</p><p>- Max. 64 chars - </p>     |
| notify\_url<mark style="color:red;">\*</mark>              | string | Donde Pagsmile enviará la notificación                                    |
| customer.identify.type<mark style="color:red;">\*</mark>   | string | <p>Tipo de identificación de usuario</p><p>- NIT o CC -</p>               |
| customer.name<mark style="color:red;">\*</mark>            | string | Nombre de usuario                                                         |
| timestamp<mark style="color:red;">\*</mark>                | string | <p>yyyy-MM-dd HH:mm:ss<br>- Max. 19 chars -</p>                           |
| subject<mark style="color:red;">\*</mark>                  | string | <p>Razón de pago o título</p><p>- Max. 128 chars -</p>                    |
| order\_amount<mark style="color:red;">\*</mark>            | string | <p>Monto de pago</p><p>- 2,000~3,000,000 COP -</p>                        |
| order\_currency<mark style="color:red;">\*</mark>          | string | Valor fijo: COP                                                           |
| content                                                    | string | <p>Detalle de razón de pago o título.</p><p>- Max. 255 chars -</p>        |
| buyer\_id<mark style="color:red;">\*</mark>                | string | Usuario id de merchant                                                    |
| address.zip\_code<mark style="color:red;">\*</mark>        | string | <p>zip code</p><p>- 6 digitos -</p>                                       |
| website\_url                                               | string | URL de website de merchan- Max. 128 chars -                               |
| address.street                                             | string | <p>calle</p><p>- Requerido si no hay zip_code -</p>                       |
| address.street\_number                                     | string | <p>número de calle</p><p>- Requerido si no hay zip_code -</p>             |
| address.city                                               | string | <p>ciudad</p><p>- Requerido si no hay zip_code -</p>                      |
| address.state                                              | string | <p>provincia<br>- Requerido si no hay zip_code -</p>                      |
| return\_url                                                | string | Redirigir a la URL del merchant cuando el usuario haya terminado checkout |

{% tabs %}
{% tab title="200 submit exitoso" %}
```
{
    "code": "10000",
    "msg": "Success",
    "trade_no": "2022010110293900083",
    "out_trade_no": "202201010354004",
    "web_url": "",
    "pay_url": "https://secure.payty.com/vads-payment/",
    "trade_status": "PROCESSING",
    "form_date": {
        "vads_payment_cards": "VISA;EFECTY",
        "signature": "bNEdPLCzs1RsnCxJofnF9xJ/5St40dhB65N8APdr9hM=",
        "vads_trans_date": "20220101035404",
        "vads_ctx_mode": "TEST",
        "vads_action_mode": "INTERACTIVE",
        "vads_page_action": "PAYMENT",
        "vads_order_description": "trade pay test conent",
        "vads_order_id": "2022010110293900083",
        "vads_currency": "170",
        "vads_version": "V2",
        "vads_trans_id": "118dn6",
        "vads_amount": 200000,
        "vads_payment_config": "SINGLE",
        "vads_site_id": "10454805"
    }
}
```
{% endtab %}

{% tab title="400 duplicar out_trade_no" %}
```
{
    "code": "40002",
    "msg": "Business Failed",
    "sub_code": "duplicate-out_trade_no",
    "sub_msg": "out_trade_no is duplicate"
}
```
{% endtab %}
{% endtabs %}

**El merchant debe usar los datos en el response para redirigir a los usuarios a la página de pago**

```
<input type="button" id="button1" onclick="pay()" value="Test" />

<script type="text/javascript">
    function pay() {
        var pay_url = "https://secure.payty.com/vads-payment/";
        var form_date = {
            "vads_payment_cards": "VISA;EFECTY",
            "signature": "bNEdPLCzs1RsnCxJofnF9xJ/5St40dhB65N8APdr9hM=",
            "vads_trans_date": "20220101035404",
            "vads_ctx_mode": "TEST",
            "vads_action_mode": "INTERACTIVE",
            "vads_page_action": "PAYMENT",
            "vads_order_description": "trade pay test conent",
            "vads_order_id": "2022010110293900083",
            "vads_currency": "170",
            "vads_version": "V2",
            "vads_trans_id": "118dn6",
            "vads_amount": 200000,
            "vads_payment_config": "SINGLE",
            "vads_site_id": "10454805"
        }
        
        location.href = pay_url + "?" + Object.keys(form_date)?.map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(form_date[k])}`).join("&");
    }
</script> 
```

{% hint style="info" %}
**Consejos de pago para el usuario**

Los usuarios deben usar el **Merchant ID** y la **referencia** para realizar el pago en la tienda local.
{% endhint %}

## Ejemplo

```
curl --location --request POST 'https://gateway-test.pagsmile.com/trade/pay' \
--header 'Authorization: Basic MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==' \
--header 'Content-Type: application/json' \
--data-raw '{
    "app_id": "162************38",
    "out_trade_no": "202201010354004",
    "method": "Efecty",
    "order_amount": "3000",
    "order_currency": "COP",
    "subject": "trade pay test",
    "content": "trade pay test conent",
    "notify_url": "http://merchant/callback/success",
    "return_url": "https://www.merchant.com",
    "buyer_id": "buyer_0101_0001",
    "timestamp": "2022-01-01 03:54:01",
    "timeout_express":"1c",
    "customer" : {
        "identify": {
            "type": "NIT",
            "number": "502844147"
        },
        "name": "Test User Name",
        "email": "test@pagsmile.com",
        "phone": "3007654321"
    },
    "address" : {
        "zip_code": "300760",
    }'
```

![User checkout page](https://2584313084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSp0n8Ga3fqQGsHvx38Np%2Fuploads%2FsaEYqv4uRF6AOXPKG2tH%2Fimage.png?alt=media\&token=a233af9f-b072-426a-9fd6-0d1883babb35)

![User payment page](https://2584313084-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSp0n8Ga3fqQGsHvx38Np%2Fuploads%2FDjhjZsfWe9VzYfCAry5h%2Fimage.png?alt=media\&token=f6d8b05e-094e-4557-9c46-47fad1596a79)

{% hint style="info" %}
Nota:  **162\*\*\*\*\*\*\*\*\*\*\*\*38** es el test ID de pagsmile para prueba en sandbox, y **MTYyNTgyOTIxNDUzMTY2Mzg6UGFnc21pbGVfc2tfZDUwMWQ1ZGNkNTI5OGQ5N2MwNmUzYjI4YjA2OWZjZmY3NDU5ZjY2NzNiMjFjMTFlYTY3NDM5MDgzOTZkOTYxNQ==** es el token de autorización asociado con el app ID de prueba.&#x20;
{% endhint %}

{% hint style="danger" %}
Favor utilizar tu propio **app\_id** y genera tu propio **authorization token** al realizar pruebas.
{% endhint %}
