# SPEI

**The Sistema de Pagos Electrónicos Interbancarios (SPEI) is an electronic payment system developed and operated by the Banco de México, which is Mexico’s central bank. SPEI facilitates real-time , secure electronic transfers between bank accounts within the country.**

## **Features**

| Processing currencies      | MXN      |
| -------------------------- | -------- |
| Settlement currencies      | USD      |
| Minimum transaction amount | 1.00 MXN |
| Refunds                    | ❌        |
| Partial Refunds            | ❌        |
| Multiple partial refund    | ❌        |
| Chargeback                 | ❌        |

# **Integration Method**

**Payment method enumeration values:** **`spei`**

**There is integration method for SPEI**

1. Direct API
2. Checkout

## **Direct** **API** 

### **How to integration**

For direct API integration, you can create a PaymentIntent and get url in only one step. The following is the demo of creating payment intent:

**Create a PaymentIntent**

A PaymentIntent is an object that represents your intent to collect payment from your customer and tracks the lifecycle of the payment process. Create a PaymentIntent on your server and specify the amount to collect and a supported currency. If you have an existing Payment Intents integration, add `spei`the list of payment method types.

***Request*** [Create a PaymentIntent](api-42631218)

```JSON
{
    "amount":1000,
    "currency":"BRL",
    "confirm":true,
    "payment_method_data" : {
        "type":"spei",
        "billing_details": {
            "name": "Test Name"
        }
    },
    "payment_method_options":{
        "spei":{
            "curp":"PAPP971101MASNNN01",
            "rfc_pf":"PAPP971101F15"
        }
    },
    "description": "product description",
    "merchant_order_id": "Order112344343",
    "return_url":"https://your.website"
}
```

***Response***

```JSON
{
    "id": "pi_1858691017545351168",
    "object": "payment_intent",
    "created": 1731981446000,
    "livemode": true,
    "currency": "MXN",
    "amount": 1000,
    "status": "requires_action",
    "client_secret": "pi_1858691017545351168_secret_5gpILS8AXPv3yxO55TwlTEbQ",
    "next_action": {
        "type": "spei_handle_redirect",
        "spei_handle_redirect": {
            "url": "https://XXXXXXXXXXXXXXXXXXXXX"
        }
    },
    "payment_method_types": [
        "spei",
    ],
    "confirmation_method": "automatic",
    "payment_method_options": {
        "spei": {
            "curp": "PAPP971101MASNNN01",
            "rfc_pf": "PAPP971101F15"
        }
    },
    "return_url": "https://swooshtransfer.com/",
    "payment_method": "pm_1858691017415327744",
    "capture_method": "automatic"
}
```

## **Checkout**

### Payment flow

1. Customer selects SPEI from the list of payment methods available and clicks on the Pay botton


![e31bcfc8-5e54-4cae-8f18-76c8ac20e107.png](https://api.apifox.com/api/v1/projects/1296482/resources/478125/image-preview)


![beda8d1c-df45-49ba-a43d-3454d0f7ccbe.png](https://api.apifox.com/api/v1/projects/1296482/resources/478126/image-preview)

### [Create a Session](api-42654181)

***Request*** 

```JSON
{
    "cancel_url": "www.wooshpay.com",
    "mode": "payment",
    "success_url": "https://wooshpay.com/",
    "payment_method_types": [
        "spei"
    ],
    "line_items": [
        {
            "price_data": {
                "currency": "MXN",
                "unit_amount": 20000,
                "nickname": "apple",
                "product_data": {
                    "name": "apple"
                }
            },
            "quantity": 1
        }
    ]
}
```

***Response***

```JSON
{
    "id": "cs_1858755815456899072",
    "object": "checkout.session",
    "created": 1731996895000,
    "livemode": true,
    "currency": "MXN",
    "customer": "",
    "mode": "payment",
    "status": "open",
    "url": "https://checkout.wooshpay.com/pay/cs_1858755815456899072?key=cGtfbGl2ZV9OVEUzTmpBNU16ZzRPREV3TmpReU5ETXlNREF4T2tsVGR6VkZSVEZxWm5ST2FXbDJhM3B1VVc1VGVIcE1TakUzTURnMk56VTFNakExTnpn",
    "cancel_url": "www.wooshpay.com",
    "line_items": {
        "object": "list",
        "data": [
            {
                "id": "li_1858755815473676288",
                "object": "item",
                "currency": "MXN",
                "description": "Test Product",
                "price": {
                    "id": "price_1858755815490453504",
                    "object": "price",
                    "created": 1731996895000,
                    "livemode": true,
                    "active": true,
                    "currency": "MXN",
                    "nickname": "apple",
                    "product": {
                        "id": "prod_1858755815511425024",
                        "object": "product",
                        "created": 1731996895000,
                        "livemode": true,
                        "active": true,
                        "name": "Test Product",
                        "updated": 1731996895000,
                        "images": [
                            "https://appletservice.oss-accelerate.aliyuncs.com/checkout_0517/icon0720/pic.png"
                        ]
                    },
                    "type": "one_time",
                    "unit_amount": 20,
                    "billing_scheme": "per_unit"
                },
                "quantity": 7,
                "amount_subtotal": 140,
                "amount_total": 140
            }
        ]
    },
    "payment_intent": "pi_1858755815737917440",
    "payment_method_types": [
        "spei"
    ],
    "payment_status": "unpaid",
    "success_url": "https://wooshpay.com/",
    "amount_subtotal": 140,
    "amount_total": 140,
    "billing_address_collection": "auto",
    "expires_at": 1732083295078,
    "payment_link": "",
    "client_secret": "pi_1858755815737917440_secret_7VRbujSC2ey7Wye2STHJENvx",
    "customer_creation": "if_required",
    "total_details": {
        "amount_discount": 0
    }
}
```

# **Next step**

You can add more features to your integration as needed

## Webhook

Listen to events on your WooshPay account so your integration can automatically trigger reactions. Create a webhook that mainly focuses on enabled_events and url.

## Refund

Create a refund to repay funds to your customer. You can also perform partial refunds, but not every payment method supports them. A partial refund is when you refund only part of the original transaction amount.
