Back to All

Payment Link: "Invalid format for expired_at"

The request to generate a payment link fails when using an expire time different than that from the example.


// Working
const thirty_days_from_now = (Math.round(Date.now()/1000 + 60 * 60 * 24 * 30)).toString()

// Not working
const two_hours_from_now = (Math.round(Date.now()/1000 + 60 * 120)).toString()


{
    "name": "some name",
    "type": "PaymentLink",
    "recurrent": false,
    "expired_at": two_hours_from_now,  // <- Not working!
    "allowed_payment_methods": [
        "cash",
        "card",
        "bank_transfer"
    ],
    "needs_shipping_contact": false,
    "order_template": {
        "line_items": [
            {
                "name": "whatever",
                "unit_price": 46399,
                "quantity": 1
            }
        ],
        "currency": "MXN",
        "customer_info": {
            "name": "chchuchuchu",
            "email": "[email protected]",
            "phone": "2221234567"
        }
    }
}