Developers · Hashry Pay
API reference
Every endpoint of the Hashry Pay API, with its request and its answers. Most integrations never call it directly: the Node and Python SDKs do, with the same field names.
- Host:
https://api.hashrytech.com, for live and sandbox. Your key picks the mode. - Authentication: get a token with
POST /auth/token(client credentials), then sendAuthorization: Bearer <token>. From your server only. - Every create takes an
Idempotency-Keyheader of 8 to 100 characters. Sending it again with the same details returns the same object. - Errors are JSON with a reason code. What each code means is in Errors.
- The schema is OpenAPI 3.1: download hashry-pay.json (version 1.0.0).
Note:
There is no "try it" button. It would need your client secret in the browser, and Hashry refuses keys sent from a browser. Try requests from your server with a test key.
Endpoints
Authentication
| POST | /auth/token Get an access token with a channel keyOAuth 2.0 client credentials grant with a JSON body. Call it from your server only: a channel key used from a browser is refused. Fields:grant_type, client_id, client_secret |
Payment intents
| GET | /v1/channel/payment-intents Find payment intents by your referenceUse it to find a payment when you lost the create response. |
| POST | /v1/channel/payment-intents Create a payment intentFields:store_uid, amount, currency, description, external_reference, payer, return_url, cancel_url, presentation, embed_origin, external_customer_reference, allow_save_card, offer_saved_cards, retry_after_decline |
| GET | /v1/channel/payment-intents/{uid} Read a payment intent |
| POST | /v1/channel/payment-intents/{uid}/attempts Retry a declined paymentStarts a new attempt. Allowed only after a decline (`requires_payment_method`). Fields:presentation, embed_origin |
| POST | /v1/channel/payment-intents/{uid}/cancel Cancel a payment intent |
| POST | /v1/channel/payment-intents/{uid}/refresh Ask the gateway now, then readAsks the gateway for the latest outcome, applies it, then returns the payment intent. Use it when a webhook is late or was missed. Hashry asks the gateway at most once every few seconds per payment; calls in between return the stored state. Never returns the card form URL. |
Payment links
| GET | /v1/channel/payment-links List payment links |
| POST | /v1/channel/payment-links Create a payment linkFields:store_uid, amount, currency, description, external_reference, payer, return_url, cancel_url, expires_at |
| GET | /v1/channel/payment-links/{uid} Read a payment link |
| POST | /v1/channel/payment-links/{uid}/cancel Cancel a payment link |
Payment methods
| GET | /v1/channel/payment-methods List a customer's saved cards |
| DELETE | /v1/channel/payment-methods/{uid} Remove a saved card |
| POST | /v1/channel/payment-methods/forget-customer Forget a customer and remove their cardsCall it when the person deletes their account with you. With a live key, Hashry removes every saved card (live and test) and retires the reference; it is refused with 409 `customer_has_active_subscriptions` while a subscription bills them. With a test key, only the test cards are removed. One call is enough: a removal the gateway has not confirmed yet finishes later (202, `cards_pending`). A repeat, or a reference Hashry never saw, is a quiet success. Fields:external_customer_reference |
Channel
| GET | /v1/channel/self Read the channel behind this key |
Subscription intents
| GET | /v1/channel/subscription-intents Find enrollments by your subscription referenceUse it to find an enrollment when you lost the create response. |
| POST | /v1/channel/subscription-intents Enroll a customer in a subscriptionFields:plan, payer, external_customer_reference, external_subscription_reference, currency, return_url, cancel_url |
| GET | /v1/channel/subscription-intents/{uid} Read an enrollment |
Subscriptions
| GET | /v1/channel/subscriptions List subscriptionsLive keys only. A test key gets an empty list. |
| GET | /v1/channel/subscriptions/{uid} Read a subscription |
| POST | /v1/channel/subscriptions/{uid}/cancel Cancel at the end of the paid periodSchedules the end of the subscription. The customer keeps what they paid for until the period ends, and nothing more is charged. You get `subscription.cancellation_scheduled` now and `subscription.canceled` when the period ends. Before then, uncancel undoes it. |
| GET | /v1/channel/subscriptions/{uid}/charges List a subscription's charges |
| POST | /v1/channel/subscriptions/{uid}/retry-now Charge a suspended subscription's unpaid cycle againCharges the unpaid cycle once more, on the card on file, for the same amount. Use it when the card was never the problem: a bank outage, or an issuer hold that has since cleared. If the card itself was refused, start an update-card session instead. No Idempotency-Key: a repeat call gets 409 `retry_already_scheduled`. `charge_created` says whether a charge was made. |
| POST | /v1/channel/subscriptions/{uid}/uncancel Remove a scheduled cancellationUndoes a scheduled cancellation, so billing goes on as before. A canceled or expired subscription cannot be restored: enroll the customer again. |
| POST | /v1/channel/subscriptions/{uid}/update-card-session Start a hosted card-update sessionReturns a Hashry page where the customer enters a new card for this subscription. Send the customer to `update_url` before `expires_at`. `return_url` and `cancel_url` must be on the channel's allowed return origins. While a session is open, a new call returns it with 200. Fields:return_url, cancel_url, reason |
Public
| GET | /v1/public/payment-intents/{uid}/status Read a payment's status from a browserNo key. The status token is the only credential. Browsers on the channel's allowed embed or return origins may read the answer. |