Skip to content

PlanetPay integration

The PlanetPay gateway in Polski PRO lets a WooCommerce store take BLIK, card, Przelewy24 bank transfer, Google Pay and Apple Pay payments through a PlanetPay merchant account. It appears at checkout only after the signing key for the active mode is saved and at least one payment method is enabled. Refunds go through the WooCommerce order screen.

Go to WooCommerce > Settings > Payments > PlanetPay (gateway ID polski_planetpay).

Setting Description Default
Enable/Disable Turns the gateway on Off
Title Payment method name shown at checkout PlanetPay
Description Text shown under the method at checkout Pay with BLIK, card or bank transfer.
Transaction description Text sent to PlanetPay; {order_id} is replaced with the order number Order #{order_id}

The gateway keeps two sets of credentials and uses one of them depending on Sandbox mode.

Setting Description
Sandbox mode Uses the sandbox API (api.sandbox.planetpay.pl) instead of production (api.planetpay.pl). On by default
Merchant ID Production merchant identifier
Merchant secret Production merchant secret
Notification signing key Production key for verifying webhooks (SHA256 HMAC)
Sandbox Merchant ID Merchant identifier for the sandbox
Sandbox secret Merchant secret for the sandbox
Sandbox signing key Webhook key for the sandbox, from PlanetPay. Empty by default

If the merchant ID or secret for the active mode is empty, the customer sees "Payment service temporarily unavailable. Please try again." and the order is not sent.

The gateway is not offered at checkout until the signing key for the active mode is saved: Notification signing key in production, Sandbox signing key in sandbox mode. Without that key no payment notification could be verified. A key of 64 a characters, the placeholder older versions prefilled, counts as no key. The gateway is also hidden when no payment method is enabled.

Method Code sent to PlanetPay Default
BLIK BLIK On
Cards CARD On
Bank transfers (Przelewy24) PBL On
Google Pay GPAY Off
Apple Pay APAY Off

When two or more methods are enabled, the customer picks one with a radio button at checkout. With only one method enabled no choice is shown and that method is sent. If that method is BLIK, the BLIK code field is shown straight away.

The amount is sent in the smallest currency unit (order total x 100) together with the order currency, the billing name, e-mail and phone, the return URL and the payment notification URL.

  1. The customer selects BLIK and enters the 6-digit code; anything other than six digits stops the checkout with "Please enter a valid 6-digit BLIK code."
  2. The code is sent to the PlanetPay API, the customer is not redirected
  3. If PlanetPay answers COMPLETED, the order is marked as paid at once
  4. If it answers PENDING, the order goes to On hold with the note "Awaiting BLIK confirmation." and the payment webhook completes it later
  5. Any other answer shows "BLIK payment failed. Please try again."
  1. The customer selects a card, bank transfer, Google Pay or Apple Pay
  2. The order stays Pending payment with a note naming the method, and the customer is redirected to the PlanetPay paywall
  3. The payment webhook updates the order status
Status in the webhook What happens to the order
COMPLETED Marked as paid (payment_complete), unless it is already paid; note "PlanetPay payment confirmed via webhook."
REJECTED Set to Failed
CANCELED Set to Failed
PENDING No change

The status after payment_complete is the one WooCommerce picks: Processing, or Completed for orders with only virtual downloadable products.

Refunds are started from the WooCommerce order screen with the automatic refund button of the gateway. The gateway sends the PlanetPay payment ID, the amount (x 100) and the refund reason (or "Refund" when empty) and adds an order note "PlanetPay refund initiated" with the refund ID.

The refund needs the PlanetPay payment ID saved on the order in the _planetpay_payment_id meta. It is saved for redirect payments and for every BLIK payment, also one confirmed immediately. When the meta is missing, the gateway uses the order's transaction ID instead, so BLIK orders paid before version 1.32.3 can be refunded too. With neither, WooCommerce reports the refund as failed.

The refund webhook only adds an order note "PlanetPay refund status: ..." with the status and refund ID; it does not change the order status.

Endpoint Description
/wp-json/polski-pro/v1/planetpay/payment Payment status notifications
/wp-json/polski-pro/v1/planetpay/refund Refund status notifications

The payment URL is sent to PlanetPay with every payment as notifyUrl. The refund URL is not sent with the refund request.

Both endpoints accept POST requests with a JSON body that contains extOrderId (the WooCommerce order ID) and status. Each request must carry an X-Planetpay-Signature header with the hex SHA256 HMAC of the raw body, computed with the signing key of the active mode. The endpoints answer:

Code Reason
200 Notification accepted
400 Body is not JSON or extOrderId is missing
403 Signature missing or wrong, the signing key is empty, or the order was not paid with PlanetPay
404 No order with that ID
  1. Leave Sandbox mode on and fill in Sandbox Merchant ID, Sandbox secret and Sandbox signing key
  2. Place a test order with each method you enabled and check the order notes
  3. To check the webhook by hand, sign the body with the sandbox key and send it to the payment endpoint:
Terminal window
BODY='{"extOrderId":"123","status":"COMPLETED","paymentId":"test"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac 'YOUR_SANDBOX_SIGNING_KEY' | sed 's/^.* //')
curl -X POST https://example.com/wp-json/polski-pro/v1/planetpay/payment \
-H 'Content-Type: application/json' -H "X-Planetpay-Signature: $SIG" -d "$BODY"
  1. Before going live turn Sandbox mode off and make sure the production Merchant ID, secret and signing key are filled in

Why is PlanetPay not shown at checkout?

Section titled "Why is PlanetPay not shown at checkout?"

The gateway hides itself until the signing key of the active mode is saved (Notification signing key in production, Sandbox signing key in sandbox mode) and at least one payment method is on. A key of 64 a characters counts as empty.

Is the customer redirected to pay with BLIK?

Section titled "Is the customer redirected to pay with BLIK?"

No. The customer types the 6-digit BLIK code at checkout and the plugin sends it to PlanetPay directly. Cards, bank transfers, Google Pay and Apple Pay redirect to the PlanetPay paywall.

What happens to the order while BLIK waits for confirmation?

Section titled "What happens to the order while BLIK waits for confirmation?"

If PlanetPay answers PENDING, the order goes to On hold with the note "Awaiting BLIK confirmation." The payment webhook marks it as paid when PlanetPay sends COMPLETED.

Can I refund a PlanetPay order from WooCommerce?

Section titled "Can I refund a PlanetPay order from WooCommerce?"

Yes, with the automatic refund button on the order screen. The order needs the _planetpay_payment_id meta or a transaction ID; without either, WooCommerce reports the refund as failed.