Skip to main content
POST
/
v1
/
aggregators
/
{raast-aggregator-id}
/
merchants
Create Merchant
curl --request POST \
  --url https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants \
  --header 'Content-Type: application/json' \
  --header 'X-SFPY-AGGREGATOR-SECRET-KEY: <api-key>' \
  --data '
{
  "merchant_external_id": "sec_0c3de397-441f-471f-bcd7-b6d948e1c307",
  "iban": "PK62ABPA0010000222380013",
  "name": "TestingMerchant",
  "enabled": true,
  "raast_merchant_id": "mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2",
  "rate_card": {
    "ratecard_kind": "RateCardKind_fixed",
    "variable_rate": 0.0215,
    "fixed_rate": 2900,
    "tax_rate": 0.1,
    "tax_region": "Punjab",
    "sales_tax_withholding": 0.1,
    "income_tax_withholding": 0.02
  }
}
'
import requests

url = "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants"

payload = {
"merchant_external_id": "sec_0c3de397-441f-471f-bcd7-b6d948e1c307",
"iban": "PK62ABPA0010000222380013",
"name": "TestingMerchant",
"enabled": True,
"raast_merchant_id": "mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2",
"rate_card": {
"ratecard_kind": "RateCardKind_fixed",
"variable_rate": 0.0215,
"fixed_rate": 2900,
"tax_rate": 0.1,
"tax_region": "Punjab",
"sales_tax_withholding": 0.1,
"income_tax_withholding": 0.02
}
}
headers = {
"X-SFPY-AGGREGATOR-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'X-SFPY-AGGREGATOR-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
merchant_external_id: 'sec_0c3de397-441f-471f-bcd7-b6d948e1c307',
iban: 'PK62ABPA0010000222380013',
name: 'TestingMerchant',
enabled: true,
raast_merchant_id: 'mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2',
rate_card: {
ratecard_kind: 'RateCardKind_fixed',
variable_rate: 0.0215,
fixed_rate: 2900,
tax_rate: 0.1,
tax_region: 'Punjab',
sales_tax_withholding: 0.1,
income_tax_withholding: 0.02
}
})
};

fetch('https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants",
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([
'merchant_external_id' => 'sec_0c3de397-441f-471f-bcd7-b6d948e1c307',
'iban' => 'PK62ABPA0010000222380013',
'name' => 'TestingMerchant',
'enabled' => true,
'raast_merchant_id' => 'mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2',
'rate_card' => [
'ratecard_kind' => 'RateCardKind_fixed',
'variable_rate' => 0.0215,
'fixed_rate' => 2900,
'tax_rate' => 0.1,
'tax_region' => 'Punjab',
'sales_tax_withholding' => 0.1,
'income_tax_withholding' => 0.02
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-SFPY-AGGREGATOR-SECRET-KEY: <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.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants"

payload := strings.NewReader("{\n \"merchant_external_id\": \"sec_0c3de397-441f-471f-bcd7-b6d948e1c307\",\n \"iban\": \"PK62ABPA0010000222380013\",\n \"name\": \"TestingMerchant\",\n \"enabled\": true,\n \"raast_merchant_id\": \"mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2\",\n \"rate_card\": {\n \"ratecard_kind\": \"RateCardKind_fixed\",\n \"variable_rate\": 0.0215,\n \"fixed_rate\": 2900,\n \"tax_rate\": 0.1,\n \"tax_region\": \"Punjab\",\n \"sales_tax_withholding\": 0.1,\n \"income_tax_withholding\": 0.02\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-SFPY-AGGREGATOR-SECRET-KEY", "<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.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants")
.header("X-SFPY-AGGREGATOR-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchant_external_id\": \"sec_0c3de397-441f-471f-bcd7-b6d948e1c307\",\n \"iban\": \"PK62ABPA0010000222380013\",\n \"name\": \"TestingMerchant\",\n \"enabled\": true,\n \"raast_merchant_id\": \"mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2\",\n \"rate_card\": {\n \"ratecard_kind\": \"RateCardKind_fixed\",\n \"variable_rate\": 0.0215,\n \"fixed_rate\": 2900,\n \"tax_rate\": 0.1,\n \"tax_region\": \"Punjab\",\n \"sales_tax_withholding\": 0.1,\n \"income_tax_withholding\": 0.02\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.getsafepay.com/raastwire/v1/aggregators/{raast-aggregator-id}/merchants")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-SFPY-AGGREGATOR-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_external_id\": \"sec_0c3de397-441f-471f-bcd7-b6d948e1c307\",\n \"iban\": \"PK62ABPA0010000222380013\",\n \"name\": \"TestingMerchant\",\n \"enabled\": true,\n \"raast_merchant_id\": \"mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2\",\n \"rate_card\": {\n \"ratecard_kind\": \"RateCardKind_fixed\",\n \"variable_rate\": 0.0215,\n \"fixed_rate\": 2900,\n \"tax_rate\": 0.1,\n \"tax_region\": \"Punjab\",\n \"sales_tax_withholding\": 0.1,\n \"income_tax_withholding\": 0.02\n }\n}"

response = http.request(request)
puts response.read_body
{
  "api_version": "v1",
  "data": {
    "id": "0",
    "token": "am_d7fd05ea-8613-4038-afd7-4275f29110f5",
    "name": "TestingMerchant",
    "aggregator_id": "agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e",
    "merchant_id": "mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2",
    "merchant_external_id": "sec_0c3de397-441f-471f-bcd7-b6d948e1c307",
    "bank_account_id": "acc_a17a478a-f7cd-448b-9753-5729a6f237ad",
    "enabled": true,
    "created_at": "2025-05-21T09:36:42.586176361Z",
    "updated_at": "2025-05-21T09:36:42.586185862Z",
    "raast_merchant": {
      "id": "0",
      "token": "mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2",
      "partner_id": "partner_ed4f0480-36c8-4a5a-8cd4-381bc4d83f2c",
      "raast_record_id": "480776",
      "status": "Inactive",
      "uid_type": "NTN",
      "uid_value": "33225247890431",
      "name": "TestHasMerchant",
      "document_type": "NTN",
      "document_number": "33225247890431",
      "address_details": {
        "country": "PK",
        "city": "Lahore",
        "state_province_region": "Punjab",
        "address_line": "h193c1 saddiq"
      },
      "contact_details": {
        "mobile_number": "+9233330226445",
        "email": "testing1702@gmail.com"
      },
      "additional_details": {
        "dba": "The best business 001",
        "mcc": "3434",
        "lat": "",
        "long": ""
      },
      "additional_details_private": {},
      "created_at": "2025-05-21T09:36:40.660619343Z",
      "updated_at": "2025-05-21T09:36:40.660619733Z"
    },
    "rate_card": {
      "id": "0",
      "token": "mrc_859bf970-6178-48c4-a801-014d027a9fe8",
      "aggregator_merchant_id": "am_d7fd05ea-8613-4038-afd7-4275f29110f5",
      "connector_id": "conn_eec2d68c-b72a-4f84-82ff-a7d4b3ebaa21",
      "rate_card_id": "rc_d0680a67-e8bc-4a39-a7c1-ee9998346f17",
      "created_at": "2025-05-21T09:36:42.586189872Z",
      "updated_at": "2025-05-21T09:36:42.586190032Z",
      "tax_rate": 0
    }
  }
}
{
"code": "error.bad_request",
"message": "Invalid request parameters"
}

Authorizations

X-SFPY-AGGREGATOR-SECRET-KEY
string
header
required

Path Parameters

raast-aggregator-id
string
required

The unique identifier for the aggregator

Example:

"agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e"

Body

application/json

Request to create a merchant linked to an aggregator

Merchant creation payload specifying identifiers and pricing configuration

merchant_external_id
string
required

Client-supplied identifier that remains stable across Safepay integrations

iban
string
required

Settlement IBAN used for Raast payouts

name
string
required

Merchant display name

raast_merchant_id
string
required

Identifier of the previously onboarded Raast merchant to associate

rate_card
object
required

Rate configuration Safepay applies to Raast transactions

enabled
boolean

Indicates whether the merchant should be active immediately after creation

Response

This response contains details of a merchant

Standard response structure for successful operations

api_version
string

The current version of the API spec

Example:

"v1"

data
object

Merchant resource created under an aggregator for Raast transactions