Look up an order
This example uses Guzzle and Nyholm PSR-7. Disable redirects to keep your API key on its assigned origin and let the SDK manage retries.Verify a webhook
Webhook::constructEvent authenticates the exact request bytes and then parses the JSON object.
It throws OrsunPay\SignatureVerificationException when verification fails.
$secrets accepts one secret or a list.
Enforce a body-size limit and reject duplicate signature header lines before calling it. The helper
verifies the signature only; validate the event shape, merchant, order and livemode yourself.
Money
OrsunPay\Money::requireAmount($amount) returns the amount unchanged if it is a valid decimal
string (see money format) and throws otherwise. It does not check
currency precision.
Response models
OrsunPay\ResponseDecoder turns a successful (2xx) JSON body that you received with your own HTTP
client into a typed, read-only model: decodePaymentResponse, decodeTransactionStatusResponse,
decodePaymentList, decodeRefundResponse, decodeRefundList, decodePaymentLink and
decodePaymentLinkList. A body that is not a JSON object or does not match the model throws
OrsunPay\InvalidResponseException (an OrsunPayException with errorCode INVALID_RESPONSE, no
response data, not retryable).
Errors and retries
The package also contains an exception hierarchy (OrsunPayException with AuthenticationException,
ValidationException, ConflictException, IdempotencyException, RateLimitException,
UpstreamException, ConnectionException, PaymentRejectedException, InvalidResponseException), an ErrorMapper and a
RetryPolicy, used by the HTTP client.