Express.js Handler
// Webhook endpoint to receive payment notifications
app.post('/webhooks/rebell', express.json(), (req, res) => {
// 1. Verify the signature (see Authentication docs)
if (!verifySignature(req)) {
return res.status(401).json({ result: { resultStatus: 'F' } });
}
const { paymentId, paymentRequestId, paymentStatus, paymentAmount } = req.body;
// 2. Process the payment result
if (paymentStatus === 'SUCCESS') {
// Update order status, trigger fulfillment, etc.
updateOrderStatus(paymentRequestId, 'paid');
} else if (paymentStatus === 'FAIL') {
updateOrderStatus(paymentRequestId, 'failed');
}
// 3. Acknowledge receipt
res.json({ result: { resultStatus: 'S' } });
});from flask import Flask, request, jsonify
@app.route('/webhooks/rebell', methods=['POST'])
def handle_payment_webhook():
# 1. Verify the signature (see Authentication docs)
if not verify_signature(request):
return jsonify({'result': {'resultStatus': 'F'}}), 401
data = request.json
payment_status = data['paymentStatus']
payment_request_id = data['paymentRequestId']
# 2. Process the payment result
if payment_status == 'SUCCESS':
update_order_status(payment_request_id, 'paid')
elif payment_status == 'FAIL':
update_order_status(payment_request_id, 'failed')
# 3. Acknowledge receipt
return jsonify({'result': {'resultStatus': 'S'}})curl --request POST \
--url https://api.rebellapp.com/webhooks/paymentNotify \
--header 'Client-Id: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Request-Time: <api-key>' \
--header 'Signature: <api-key>' \
--data '
{
"paymentId": "<string>",
"paymentRequestId": "<string>",
"paymentAmount": {
"currency": "<string>",
"value": 123
},
"paymentTime": "2023-11-07T05:31:56Z",
"paymentCreatedTime": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rebellapp.com/webhooks/paymentNotify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'paymentId' => '<string>',
'paymentRequestId' => '<string>',
'paymentAmount' => [
'currency' => '<string>',
'value' => 123
],
'paymentTime' => '2023-11-07T05:31:56Z',
'paymentCreatedTime' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Client-Id: <api-key>",
"Content-Type: application/json",
"Request-Time: <api-key>",
"Signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.rebellapp.com/webhooks/paymentNotify"
payload := strings.NewReader("{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Signature", "<api-key>")
req.Header.Add("Client-Id", "<api-key>")
req.Header.Add("Request-Time", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.rebellapp.com/webhooks/paymentNotify")
.header("Signature", "<api-key>")
.header("Client-Id", "<api-key>")
.header("Request-Time", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rebellapp.com/webhooks/paymentNotify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Signature"] = '<api-key>'
request["Client-Id"] = '<api-key>'
request["Request-Time"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"resultCode": "<string>",
"resultMessage": "<string>"
}
}Webhooks
Payment Notify Webhook
Payment notification payload sent to your webhook endpoint.
POST
/
webhooks
/
paymentNotify
Express.js Handler
// Webhook endpoint to receive payment notifications
app.post('/webhooks/rebell', express.json(), (req, res) => {
// 1. Verify the signature (see Authentication docs)
if (!verifySignature(req)) {
return res.status(401).json({ result: { resultStatus: 'F' } });
}
const { paymentId, paymentRequestId, paymentStatus, paymentAmount } = req.body;
// 2. Process the payment result
if (paymentStatus === 'SUCCESS') {
// Update order status, trigger fulfillment, etc.
updateOrderStatus(paymentRequestId, 'paid');
} else if (paymentStatus === 'FAIL') {
updateOrderStatus(paymentRequestId, 'failed');
}
// 3. Acknowledge receipt
res.json({ result: { resultStatus: 'S' } });
});from flask import Flask, request, jsonify
@app.route('/webhooks/rebell', methods=['POST'])
def handle_payment_webhook():
# 1. Verify the signature (see Authentication docs)
if not verify_signature(request):
return jsonify({'result': {'resultStatus': 'F'}}), 401
data = request.json
payment_status = data['paymentStatus']
payment_request_id = data['paymentRequestId']
# 2. Process the payment result
if payment_status == 'SUCCESS':
update_order_status(payment_request_id, 'paid')
elif payment_status == 'FAIL':
update_order_status(payment_request_id, 'failed')
# 3. Acknowledge receipt
return jsonify({'result': {'resultStatus': 'S'}})curl --request POST \
--url https://api.rebellapp.com/webhooks/paymentNotify \
--header 'Client-Id: <api-key>' \
--header 'Content-Type: application/json' \
--header 'Request-Time: <api-key>' \
--header 'Signature: <api-key>' \
--data '
{
"paymentId": "<string>",
"paymentRequestId": "<string>",
"paymentAmount": {
"currency": "<string>",
"value": 123
},
"paymentTime": "2023-11-07T05:31:56Z",
"paymentCreatedTime": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rebellapp.com/webhooks/paymentNotify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'paymentId' => '<string>',
'paymentRequestId' => '<string>',
'paymentAmount' => [
'currency' => '<string>',
'value' => 123
],
'paymentTime' => '2023-11-07T05:31:56Z',
'paymentCreatedTime' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Client-Id: <api-key>",
"Content-Type: application/json",
"Request-Time: <api-key>",
"Signature: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.rebellapp.com/webhooks/paymentNotify"
payload := strings.NewReader("{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Signature", "<api-key>")
req.Header.Add("Client-Id", "<api-key>")
req.Header.Add("Request-Time", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.rebellapp.com/webhooks/paymentNotify")
.header("Signature", "<api-key>")
.header("Client-Id", "<api-key>")
.header("Request-Time", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rebellapp.com/webhooks/paymentNotify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Signature"] = '<api-key>'
request["Client-Id"] = '<api-key>'
request["Request-Time"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"paymentId\": \"<string>\",\n \"paymentRequestId\": \"<string>\",\n \"paymentAmount\": {\n \"currency\": \"<string>\",\n \"value\": 123\n },\n \"paymentTime\": \"2023-11-07T05:31:56Z\",\n \"paymentCreatedTime\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"result": {
"resultCode": "<string>",
"resultMessage": "<string>"
}
}Authorizations
RSA SHA256 signature header. Example: Signature: algorithm=SHA256withRSA, keyVersion=0, signature=BASE64...
Rebell-assigned Client Id.
RFC3339 timestamp (e.g., 2019-05-28T12:12:00+08:00).
Body
application/json
Available options:
SUCCESS, PROCESSING, FAIL Amount in minor units (e.g., cents).
Show child attributes
Show child attributes
ISO 8601 creation time
Response
200 - application/json
Acknowledge receipt
Show child attributes
Show child attributes
⌘I