Skip to main content

WayForPay

WayForPay is a Ukrainian payment gateway. When the status of a payment changes, it sends a notification to the serviceUrl of that payment — with the phone and the email of the payer and, for a failed payment, a link to pay again. That is a ready "the payment did not go through — try again here" message.

Two things stand in the way today. The address is not set in the WayForPay cabinet but passed in every payment by the code of the shop. And WayForPay waits for a signed reply that AlphaFlow does not send in the first release, so it keeps repeating each notification. Read both before you start.

Written from WayForPay documentation

This page is written from the public documentation of WayForPay and has not been checked on a live account yet.

What you need​

  • An active WayForPay merchant. Any plan will do.
  • A developer, or a shop module that lets you set serviceUrl. The documentation of WayForPay does not describe a default notification address in the cabinet. The address is passed in every request (Purchase, CREATE_INVOICE) by the code of the shop or by the CMS module, and the module uses it to confirm the order on the site.
  • If the payments go through a module of your shop, change nothing in WayForPay and take the "paid" event from the shop or the CRM: for example, a KeyCRM trigger on «Зміна статусу оплати» → «Оплачено» sends order_paid, the event the ready-made templates expect. Without code, this is the only way.
  • WayForPay will keep resending. It expects a signed reply with accept, and AlphaFlow answers every request with a plain 200 and {"status":"success"}. The signed reply is not supported in the first release, so WayForPay repeats every notification for 4 days.

Step 1. Create a connection​

  1. Open Flows → Connections, press Connect a system and choose WayForPay.
  2. Press Copy address. It looks like https://events.alphasms.net/hooks/<TOKEN> — keep it secret.

Step 2. Set up WayForPay​

This step is for the developer of the shop:

  1. In the request Purchase or CREATE_INVOICE, pass serviceUrl — the address from the cabinet.
  2. A payment has one serviceUrl. If the shop confirms orders by the same notification, the address is taken — then use the "paid" event from the shop.
  3. The SecretKey of the merchant is not needed: the secret of the connection is in the address.

Step 3. Send a test​

Make a test payment with the test card details of WayForPay (see the documentation below). The event appears in Flows → Connections → Event journal within seconds, and the connection shows Recognised: WayForPay. The same notification will come again and again — the repeats are not recorded as new events.

Events​

WayForPay statusAlphaFlow eventProperties
Approvedpayment_succeededorder_id, total, currency, status, reason, reason_code
Declined, Expiredpayment_failedorder_id, total, currency, status, reason, reason_code, payment_url
Refunded, Voidedrefund_issuedorder_id, total, currency, status, reason, reason_code
  • order_id is the orderReference of the payment; total is in hryvnias.
  • payment_url is the link to pay again (repayUrl). It comes only with a failed payment.
  • InProcessing, WaitingAuthComplete, Pending and RefundInProcessing start nothing.

The contact is found by the phone (phone) and the email (email) of the payer. The name of the payer is not in the notification. The phone may come as 380501234567 or +38063-333-33-33 — AlphaFlow reads either.

Payment events are not among the events of the ready-made templates (see Recommended events): create the flow From scratch and choose the event as its start.

Good to know​

  • Until WayForPay gets the signed accept, it repeats the notification for 4 days. Every repeat has the same order, status and time of processing, so it is not recorded twice. Whether WayForPay marks these deliveries as failed in your merchant cabinet is not confirmed by its documentation.
  • The signature merchantSignature is optional: the secret in the address is enough.
  • The address always answers 200. Above the daily event limit the event is refused in AlphaFlow with quota_exceeded and shown in the journal.

WayForPay documentation​