Create a payment
Creates a payment and returns the checkout_url to send your customer to.
Send the customer to the returned checkout_url (redirect), or open it as a popup with new PaybetaPop().resumeTransaction(id), using the payment's id.
modedecides whether this is a test payment (no real money) or a live one. See Test mode.- Sending the same
referenceand amount again returns the existing payment (200 OK), so a timed-out request is safe to retry. The samereferencewith another amount is refused (409 Conflict). - Keep the
idor yourreferenceto verify the payment later.
More examples (pick them in the Request menu): a payment where the customer pays the fee, a Paybeta wallet-only payment, and a live payment.
The payment object
| Field | Description |
|---|---|
id |
Paybeta's id for the payment (GTW-…). |
reference |
Your reference. |
status |
pending, successful, failed or expired. |
amount |
The amount you asked for, in naira. |
fee |
Paybeta's fee. |
pass_charge |
Whether the fee is added on top for the customer. |
charge_amount |
What the customer pays: amount, or amount + fee with pass_charge. |
amount_paid |
What the customer paid, once paid; null before. |
merchant_amount |
What you receive. |
mode / livemode |
test or live. |
channel |
How it was paid (card, transfer, bank, ussd, wallet); null until paid. |
customer, description, metadata |
As you sent them. |
recurring, authorization |
Saved cards; not available yet. |
checkout_url |
The payment page. |
failure_reason |
Why the last attempt was declined, if it was. |
expires_at, paid_at, created_at |
Times (ISO 8601, West Africa Time, +01:00). |
P-API-KEY header. Keep it on your server, never in an app or browser.Body (JSON)
-
mode string Required
test(sandbox, no real money) orlive.Example:test -
reference string Required
Your unique reference for this payment. Reusing it with the same amount returns the existing payment.
Example:ORDER-1001 -
amount number Required
In naira. Minimum ₦100.
Example:5000 -
currency string Optional
NGN(the only currency).Example:NGN -
customer object Required
Who is paying.
-
customer.email string Required
The customer's email.
Example:ada@example.com -
customer.name string Optional
The customer's name.
Example:Ada Lovelace -
customer.phone string Optional
The customer's phone number.
Example:08012345678 -
description string Optional
Shown to the customer on the payment page.
Example:Pro plan · monthly -
redirect_url string Optional
Where the customer goes after paying (https).
Example:https://shop.example.com/thanks -
webhook_url string Optional
Where the webhook goes (public https). Without it, the one saved in the API console is used.
Example:https://shop.example.com/webhooks/paybeta -
channels string Optional
The payment options to offer:
card,transfer,bank,ussd,wallet. Options switched off for your account are left out.Example:["card","transfer", "bank", "wallet", "ussd"] -
pass_charge boolean Optional
trueadds Paybeta's fee on top for the customer, so you receive the full amount. Without it, your console default applies.Example:false -
metadata object Optional
Your own data (up to 4KB), returned on the payment and its webhook.
Example:{"cart_id":9} -
expires_in integer Optional
Minutes until the payment page expires: 5 to 10080. Default 60.
Example:60 -
recurring boolean Optional
truesaves the card for later charges (card only). Not available yet.Example:false
Responses
- 201Created
- 201Customer pays the fee
- 200Same reference again
- 400Validation error
- 409Same reference, different amount
curl --request POST \ --url 'https://api.paybeta.ng/api/v1/payments' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'P-API-KEY: YOUR_SECRET_KEY' \ --data '{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": ["card", "transfer", "bank", "ussd", "wallet"], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }'curl --request POST \ --url 'https://api.sandbox.paybeta.ng/api/v1/payments' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'P-API-KEY: YOUR_SECRET_KEY' \ --data '{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": ["card", "transfer", "bank", "ussd", "wallet"], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }'
<?php use Illuminate\Support\Facades\Http; $response = Http::withHeaders([ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'P-API-KEY' => 'YOUR_SECRET_KEY', ])->post('https://api.paybeta.ng/api/v1/payments', [ 'mode' => 'test', 'reference' => 'ORDER-{{$timestamp}}', 'amount' => 5000, 'currency' => 'NGN', 'description' => 'Pro plan · monthly', 'customer' => [ 'email' => 'ada@example.com', 'name' => 'Ada Lovelace', 'phone' => '08012345678', ], 'redirect_url' => 'https://shop.example.com/thanks', 'webhook_url' => 'https://shop.example.com/webhooks/paybeta', 'channels' => [ 'card', 'transfer', 'bank', 'ussd', 'wallet', ], 'pass_charge' => false, 'metadata' => [ 'cart_id' => 9, ], 'expires_in' => 60, ]); $data = $response->json();<?php use Illuminate\Support\Facades\Http; $response = Http::withHeaders([ 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'P-API-KEY' => 'YOUR_SECRET_KEY', ])->post('https://api.sandbox.paybeta.ng/api/v1/payments', [ 'mode' => 'test', 'reference' => 'ORDER-{{$timestamp}}', 'amount' => 5000, 'currency' => 'NGN', 'description' => 'Pro plan · monthly', 'customer' => [ 'email' => 'ada@example.com', 'name' => 'Ada Lovelace', 'phone' => '08012345678', ], 'redirect_url' => 'https://shop.example.com/thanks', 'webhook_url' => 'https://shop.example.com/webhooks/paybeta', 'channels' => [ 'card', 'transfer', 'bank', 'ussd', 'wallet', ], 'pass_charge' => false, 'metadata' => [ 'cart_id' => 9, ], 'expires_in' => 60, ]); $data = $response->json();
const response = await fetch('https://api.paybeta.ng/api/v1/payments', { method: 'POST', headers: { "Accept": "application/json", "Content-Type": "application/json", "P-API-KEY": "YOUR_SECRET_KEY", }, body: JSON.stringify({ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }), }); const data = await response.json();const response = await fetch('https://api.sandbox.paybeta.ng/api/v1/payments', { method: 'POST', headers: { "Accept": "application/json", "Content-Type": "application/json", "P-API-KEY": "YOUR_SECRET_KEY", }, body: JSON.stringify({ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }), }); const data = await response.json();
import requests response = requests.request( "POST", "https://api.paybeta.ng/api/v1/payments", headers={ "Accept": "application/json", "Content-Type": "application/json", "P-API-KEY": "YOUR_SECRET_KEY", }, json={ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": False, "metadata": { "cart_id": 9 }, "expires_in": 60 }, ) data = response.json()import requests response = requests.request( "POST", "https://api.sandbox.paybeta.ng/api/v1/payments", headers={ "Accept": "application/json", "Content-Type": "application/json", "P-API-KEY": "YOUR_SECRET_KEY", }, json={ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": False, "metadata": { "cart_id": 9 }, "expires_in": 60 }, ) data = response.json()
POST /api/v1/payments HTTP/1.1 Host: api.paybeta.ng Accept: application/json Content-Type: application/json P-API-KEY: YOUR_SECRET_KEY { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }POST /api/v1/payments HTTP/1.1 Host: api.sandbox.paybeta.ng Accept: application/json Content-Type: application/json P-API-KEY: YOUR_SECRET_KEY { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; String body = """ { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.paybeta.ng/api/v1/payments")) .header("Accept", "application/json") .header("Content-Type", "application/json") .header("P-API-KEY", "YOUR_SECRET_KEY") .method("POST", HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; String body = """ { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.sandbox.paybeta.ng/api/v1/payments")) .header("Accept", "application/json") .header("Content-Type", "application/json") .header("P-API-KEY", "YOUR_SECRET_KEY") .method("POST", HttpRequest.BodyPublishers.ofString(body)) .build(); HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using System.Net.Http; using System.Text; using var client = new HttpClient(); var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.paybeta.ng/api/v1/payments"); request.Headers.TryAddWithoutValidation("Accept", "application/json"); request.Headers.TryAddWithoutValidation("P-API-KEY", "YOUR_SECRET_KEY"); request.Content = new StringContent( """ { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """, Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); var data = await response.Content.ReadAsStringAsync(); Console.WriteLine(data);using System.Net.Http; using System.Text; using var client = new HttpClient(); var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.sandbox.paybeta.ng/api/v1/payments"); request.Headers.TryAddWithoutValidation("Accept", "application/json"); request.Headers.TryAddWithoutValidation("P-API-KEY", "YOUR_SECRET_KEY"); request.Content = new StringContent( """ { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """, Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); var data = await response.Content.ReadAsStringAsync(); Console.WriteLine(data);
package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, _ := http.NewRequest("POST", "https://api.paybeta.ng/api/v1/payments", strings.NewReader(`{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }`)) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json") req.Header.Set("P-API-KEY", "YOUR_SECRET_KEY") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() data, _ := io.ReadAll(res.Body) fmt.Println(string(data)) }package main import ( "fmt" "io" "net/http" "strings" ) func main() { req, _ := http.NewRequest("POST", "https://api.sandbox.paybeta.ng/api/v1/payments", strings.NewReader(`{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }`)) req.Header.Set("Accept", "application/json") req.Header.Set("Content-Type", "application/json") req.Header.Set("P-API-KEY", "YOUR_SECRET_KEY") res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close() data, _ := io.ReadAll(res.Body) fmt.Println(string(data)) }
require "net/http" require "json" uri = URI("https://api.paybeta.ng/api/v1/payments") request = Net::HTTP::Post.new(uri) request["Accept"] = "application/json" request["Content-Type"] = "application/json" request["P-API-KEY"] = "YOUR_SECRET_KEY" request.body = <<~'JSON' { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } JSON response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http| http.request(request) end data = JSON.parse(response.body)require "net/http" require "json" uri = URI("https://api.sandbox.paybeta.ng/api/v1/payments") request = Net::HTTP::Post.new(uri) request["Accept"] = "application/json" request["Content-Type"] = "application/json" request["P-API-KEY"] = "YOUR_SECRET_KEY" request.body = <<~'JSON' { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } JSON response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http| http.request(request) end data = JSON.parse(response.body)
import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody val client = OkHttpClient() val body = """ { "mode": "test", "reference": "ORDER-{{${'$'}timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """.trimIndent().toRequestBody("application/json".toMediaType()) val request = Request.Builder() .url("https://api.paybeta.ng/api/v1/payments") .method("POST", body) .addHeader("Accept", "application/json") .addHeader("Content-Type", "application/json") .addHeader("P-API-KEY", "YOUR_SECRET_KEY") .build() client.newCall(request).execute().use { response -> println(response.body?.string()) }import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody val client = OkHttpClient() val body = """ { "mode": "test", "reference": "ORDER-{{${'$'}timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """.trimIndent().toRequestBody("application/json".toMediaType()) val request = Request.Builder() .url("https://api.sandbox.paybeta.ng/api/v1/payments") .method("POST", body) .addHeader("Accept", "application/json") .addHeader("Content-Type", "application/json") .addHeader("P-API-KEY", "YOUR_SECRET_KEY") .build() client.newCall(request).execute().use { response -> println(response.body?.string()) }
import Foundation var request = URLRequest(url: URL(string: "https://api.paybeta.ng/api/v1/payments")!) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Accept") request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.setValue("YOUR_SECRET_KEY", forHTTPHeaderField: "P-API-KEY") request.httpBody = #""" { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """#.data(using: .utf8) let (data, _) = try await URLSession.shared.data(for: request) print(String(data: data, encoding: .utf8)!)import Foundation var request = URLRequest(url: URL(string: "https://api.sandbox.paybeta.ng/api/v1/payments")!) request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Accept") request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.setValue("YOUR_SECRET_KEY", forHTTPHeaderField: "P-API-KEY") request.httpBody = #""" { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } """#.data(using: .utf8) let (data, _) = try await URLSession.shared.data(for: request) print(String(data: data, encoding: .utf8)!)
import 'package:http/http.dart' as http; final response = await http.post( Uri.parse('https://api.paybeta.ng/api/v1/payments'), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'P-API-KEY': 'YOUR_SECRET_KEY', }, body: r''' { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } ''', ); print(response.body);import 'package:http/http.dart' as http; final response = await http.post( Uri.parse('https://api.sandbox.paybeta.ng/api/v1/payments'), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'P-API-KEY': 'YOUR_SECRET_KEY', }, body: r''' { "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": [ "card", "transfer", "bank", "ussd", "wallet" ], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 } ''', ); print(response.body);
{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "description": "Pro plan · monthly", "customer": { "email": "ada@example.com" }, "channels": ["card", "transfer"], "pass_charge": true }{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "description": "Pro plan · monthly", "customer": { "email": "ada@example.com" }, "channels": ["card", "transfer"], "pass_charge": true }
{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Wallet payment test", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "channels": ["wallet"] }{ "mode": "test", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Wallet payment test", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "channels": ["wallet"] }
{ "mode": "live", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": ["card", "transfer", "bank", "ussd", "wallet"], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }{ "mode": "live", "reference": "ORDER-{{$timestamp}}", "amount": 5000, "currency": "NGN", "description": "Pro plan · monthly", "customer": { "email": "ada@example.com", "name": "Ada Lovelace", "phone": "08012345678" }, "redirect_url": "https://shop.example.com/thanks", "webhook_url": "https://shop.example.com/webhooks/paybeta", "channels": ["card", "transfer", "bank", "ussd", "wallet"], "pass_charge": false, "metadata": { "cart_id": 9 }, "expires_in": 60 }
{
"status": "successful",
"message": "Payment created",
"data": {
"id": "GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"reference": "ORDER-1001",
"status": "pending",
"amount": 5000,
"fee": 70,
"pass_charge": false,
"charge_amount": 5000,
"amount_paid": null,
"merchant_amount": 4930,
"mode": "test",
"livemode": false,
"currency": "NGN",
"channel": null,
"description": "Pro plan · monthly",
"customer": {
"email": "ada@example.com",
"name": "Ada Lovelace",
"phone": "08012345678"
},
"metadata": {
"cart_id": 9
},
"recurring": false,
"authorization": null,
"checkout_url": "https://checkout.paybeta.ng/pay/GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"provider": "squad",
"provider_reference": null,
"failure_reason": null,
"expires_at": "2026-10-30T13:00:00+01:00",
"paid_at": null,
"created_at": "2026-10-30T12:00:00+01:00"
}
}
{
"status": "successful",
"message": "Payment created",
"data": {
"id": "GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"reference": "ORDER-1001",
"status": "pending",
"amount": 5000,
"fee": 70,
"pass_charge": true,
"charge_amount": 5070,
"amount_paid": null,
"merchant_amount": 5000,
"mode": "test",
"livemode": false,
"currency": "NGN",
"channel": null,
"description": "Pro plan · monthly",
"customer": {
"email": "ada@example.com",
"name": null,
"phone": null
},
"metadata": null,
"recurring": false,
"authorization": null,
"checkout_url": "https://checkout.paybeta.ng/pay/GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"provider": "squad",
"provider_reference": null,
"failure_reason": null,
"expires_at": "2026-10-30T13:00:00+01:00",
"paid_at": null,
"created_at": "2026-10-30T12:00:00+01:00"
}
}
{
"status": "successful",
"message": "Payment already exists for this reference",
"data": {
"id": "GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"reference": "ORDER-1001",
"status": "pending",
"amount": 5000,
"fee": 70,
"pass_charge": false,
"charge_amount": 5000,
"amount_paid": null,
"merchant_amount": 4930,
"mode": "test",
"livemode": false,
"currency": "NGN",
"channel": null,
"description": "Pro plan · monthly",
"customer": {
"email": "ada@example.com",
"name": "Ada Lovelace",
"phone": "08012345678"
},
"metadata": {
"cart_id": 9
},
"recurring": false,
"authorization": null,
"checkout_url": "https://checkout.paybeta.ng/pay/GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"provider": "squad",
"provider_reference": null,
"failure_reason": null,
"expires_at": "2026-10-30T13:00:00+01:00",
"paid_at": null,
"created_at": "2026-10-30T12:00:00+01:00"
}
}
{
"status": "failed",
"message": "The amount field is required.",
"data": null
}
{
"status": "failed",
"message": "Duplicate reference: a payment with this reference already exists for a different amount.",
"data": {
"id": "GTW-K3J7Q2M9X4ZP8L1N5R6T0V2B3C4D",
"reference": "ORDER-1001",
"amount": 5000,
"status": "pending"
}
}