Crear una solicitud de pago WhatsApp
Casos de uso
El vendedor crea una solicitud de pago que envia al comprador por WhatsApp.
Testear
Testee el Web Service Charge/CreatePaymentOrder desde nuestro playground: Charge/CreatePaymentOrder.
Solicitud
Pago al contado
Ejemplo de solicitud
Campos obligatorios:
- Monto: 100,00 €.
- Canal de difusión: WHATSAPP.
- Numéro de téléphone de l'acheteur : "+33611111111"
. Campos recomendados:
- Référence de la commande : "myOrderId-1234"
{ "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber":"+33611111111" } } }
{ "amount": 200050, "currency": "PEN", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber": "+51987654321" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "es_PE", "dataCollectionForm": "false" }
{ "amount": 200050, "currency": "ARS", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber": "+5491112345678" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "es_AR", "dataCollectionForm": "false" }
{ "amount": 200050, "currency": "COP", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber": "+573191234567" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "locale": "es_CO", "dataCollectionForm": "false" }
{ "amount": 200050, "currency": "EUR", "orderId": "myOrderId-999999", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber":"+5511123456789" } }, "paymentReceiptEmail": "sample@example.com", "expirationDate": "2020-04-20T20:13:26+02:00", "dataCollectionForm": "false" }
/** * I initialize the PHP SDK */ require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/keys.php'; require_once __DIR__ . '/helpers.php'; /** * Initialize the SDK * see keys.php */ $client = new Lyra\Client(); /** * I create a formToken */ $store = array("amount" => 250, "currency" => "EUR", "orderId" => uniqid("MyOrderId"), "customer" => array( "email" => "sample@example.com" )); $response = $client->post("V4/Charge/CreatePayment", $store); /* I check if there are some errors */ if ($response['status'] != 'SUCCESS') { /* an error occurs, I throw an exception */ display_error($response); $error = $response['answer']; throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] ); } /* everything is fine, I extract the formToken */ $formToken = $response["answer"]["formToken"]; ?>
/** * I initialize the PHP SDK */ require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/keys.php'; require_once __DIR__ . '/helpers.php'; /** * Initialize the SDK * see keys.php */ $client = new Lyra\Client(); /** * I create a formToken */ $store = array("amount" => 250, "currency" => "EUR", "orderId" => uniqid("MyOrderId"), "customer" => array( "email" => "sample@example.com" )); $response = $client->post("V4/Charge/CreatePayment", $store); /* I check if there are some errors */ if ($response['status'] != 'SUCCESS') { /* an error occurs, I throw an exception */ display_error($response); $error = $response['answer']; throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] ); } /* everything is fine, I extract the formToken */ $formToken = $response["answer"]["formToken"]; ?>
Todos los campos y su descripción están disponibles (menú a la izquierda): Charge/CreatePaymentOrder.
Pago en vencimientos
Prerrequisito
- sujeto a opción y/o en función de su oferta
- indisponible para pagos SEPA
Ejemplo de solicitud
Champs obligatoires :- Monto: 100,00 €.
- Canal de difusión: WHATSAPP.
- Numéro de téléphone de l'acheteur : "+33611111111"
- Regla: Pago en 3 cuotas. El primer monto es de 50,00 EUR con un intervalo de 7 días.
. Campos recomendados:
- Référence de la commande : "myOrderId-1234".
{ "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber":"+33611111111" } }, "transactionOptions": { "installmentOptions": { "firstAmount": 5000, "count": 3, "period": 7 } } }
Le premier paiement de 50,00 EUR est créé à J+0.
Le deuxième paiement de 25,00 EUR est créé à J+7.
Le troisième paiement de 25,00 EUR est créé à J+14.
Todos los campos y su descripción están disponibles (menú a la izquierda): Charge/CreatePaymentOrder.
Pago a plazos con un calendario personalizado
Prerrequisito
- sujeto a la opción "Pago anticipado en varios plazos".
- Se obvia el valor del campo Capture Delay(plazo de captura).
- indisponible para pagos SEPA
Ejemplo de solicitud
Champs obligatoires :- Monto: 100,00 €.
- Canal de difusión: WHATSAPP.
- Numéro de téléphone de l'acheteur : "+33611111111"
- Regla: Pago en 3 cuotas.
- El primer pago se efectúa el 1 de abril por un monto de 50,00 EUR.
- El segundo pago se efectúa el 1 de mayo por un monto de 30,00 EUR.
- El tercer pago se efectúa el 1 de junio por un monto de 20,00 EUR.
. Campos recomendados:
- Référence de la commande : "myOrderId-1234".
{ "amount": 10000, "currency": "EUR", "orderId": "myOrderId-1234", "channelOptions": { "channelType": "WHATSAPP", "whatsAppOptions": { "phoneNumber":"+33611111111" } }, "transactionOptions": { "installmentOptions": { "schedules": [ { "date": "2023-04-01T23:59:59+00:00", "amount": 5000 }, { "date": "2023-05-01T23:59:59+00:00", "amount": 3000 }, { "date": "2023-06-01T23:59:59+00:00", "amount": 2000 } ] } } }
/** * I initialize the PHP SDK */ require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/keys.php'; require_once __DIR__ . '/helpers.php'; /** * Initialize the SDK * see keys.php */ $client = new Lyra\Client(); /** * I create a formToken */ $store = array("amount" => 250, "currency" => "EUR", "orderId" => uniqid("MyOrderId"), "customer" => array( "email" => "sample@example.com" )); $response = $client->post("V4/Charge/CreatePayment", $store); /* I check if there are some errors */ if ($response['status'] != 'SUCCESS') { /* an error occurs, I throw an exception */ display_error($response); $error = $response['answer']; throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] ); } /* everything is fine, I extract the formToken */ $formToken = $response["answer"]["formToken"]; ?>
Respuesta
Ejemplo de respuesta
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 10000, "currency": "EUR", "locale": "fr_FR", "strongAuthentication": "AUTO", "orderId": "myOrderId-1234", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+3361111111", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": "Bonjour, voici un ordre de paiement envoyé par DEMO STORE d'un montant de 2000.50 EUR valable jusqu'au 23/04/2020. Pour confirmer, veuillez suivre le lien : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" }
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "en_GB", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+51987654321", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": Dear customer, this is a payment order sent by DEMO STORE of EUR 2,000.50 valid until 23/04/2020. To confirm, please click on the link below : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" } }
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "es_ES", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+51987654321", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": "Hola, este mensaje contiene una solicitud de pago enviada por DEMO STORE por un monto de 2.000,50 ARS, válida hasta el 23/04/2020. Para confirmar el pago, haga clic en el enlace siguiente : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" } }
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "es_ES", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+573191234567", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": "Hola, este mensaje contiene una solicitud de pago enviada por DEMO STORE por un monto de 2.000,50 COP, válida hasta el 23/04/2020. Para confirmar el pago, haga clic en el enlace siguiente : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" } }
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "es_ES", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+5491112345678", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": "Hola, este mensaje contiene una solicitud de pago por un importe de 2.000,50 PEN, válida hasta el 23/04/2020. Para confirmar el pago, haga clic en el enlace siguiente : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" } }
{ "webService": "Charge/CreatePaymentOrder", "version": "V4", "applicationVersion": "5.5.0", "status": "SUCCESS", "answer": { "paymentOrderId": "fd8f6060f824427ba687d0161e46af8f", "paymentURL": "https://secure.lyra.com/t/328zq5so", "paymentOrderStatus": "RUNNING", "creationDate": "2020-03-31T15:06:49+00:00", "updateDate": null, "amount": 200050, "currency": "EUR", "locale": "pt_BR", "strongAuthentication": "AUTO", "orderId": "myOrderId-999999", "channelDetails": { "channelType": "WHATSAPP", "mailDetails": null, "smsDetails": null, "whatsAppDetails": { "phoneNumber": "+5511123456789", "_type": "V4/WhatsAppDetails" }, "ivrDetails": null, "_type": "V4/ChannelDetails" }, "paymentReceiptEmail": "sample@example.com", "taxRate": null, "taxAmount": null, "expirationDate": "2020-04-20T18:13:26+00:00", "transactionDetails": { "cardDetails": { "manualValidation": "NO", "captureDelay": 0, "_type": "V4/CardDetails" }, "_type": "V4/PaymentOrderTransactionDetails" }, "dataCollectionForm": false, "merchantComment": null, "message": "Caro cliente, este mensagem contém uma ordem de pagamento enviada por DEMO STORE no valor de 2000.50 BRL válida até 23/04/2020. Para confirmar o pagamento, favor clicar sobre o link seguinte : https://secure.lyra.com/t/xdt0bcmo", "_type": "V4/PaymentOrder" }, "ticket": null, "serverDate": "2020-03-31T15:06:49+00:00", "applicationProvider": "PAYZEN", "metadata": null, "_type": "V4/WebService/Response" }
La solicitud de pago se envía al WhatsApp del comprador.
Consulte todos los campos y su descripción en nuestro playground:PaymentOrder
Manejo de errores
Tabla de errores
Código | Descripción |
---|---|
INT_009 | El formato del campo amount no es válido o el campo no se ha transmitido. |
INT_010 | El formato del campo currency no es válido o el campo no se ha transmitido. |
INT_050 | El parámetro strongAuthentication es inválido. |
INT_856 | El parámetro locale es inválido. |
INT_858 | El parámetro taxRate es inválido. |
INT_869 | El parámetro taxAmount es inválido. |
INT_929 | El parámetro installmentOptions.period es inválido. |
INT_930 | El parámetro installmentOptions.period es inválido. |
INT_931 | El parámetro installmentOptions.schedules[] es inválido. |
INT_932 | Parámetro installmentOptions.schedules[date] inválido. |
INT_933 | El formato del campo installmentOptions.schedules[amount] es inválido o el campo no se transmite. |
PSP_519 | Moneda desconocida. |
PSP_606 | Moneda no admitida por la afiliación. |
PSP_1007 | La fecha de vencimiento de la solicitud de pago no puede ser anterior a la fecha actual ni exceder los 90 días. |
PSP_1015 | No hay ningún formulario de recolección de datos para esta tienda. |
PSP_1018 | No se puede utilizar el formulario de recolección de datos para la moneda solicitada. |
Analizar el resultado del pago
Para conocer el resultado del pago, implemente la URL de notificación al final el pago (IPN).
- Ingrese solamente la URL de notificación en la sección API REST (TEST o PRODUCTION): Procedimiento.
- Analice la IPN: Procedimiento.