Deep Link

Create an Invoice

To sell product, client has to create an invoice. Including simple parameters like source and destination account to send and receive money, amount, product code, product name and redirect URL (client’s webhook) which will be called back after payment so that client can handle. Invoices can be created for dedicated user (with user’s auth) or can be generated public invoice which means anyone can pay.

                
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://z-wallet.monpay.mn/v2/api/oauth/invoice');
$request->setRequestMethod('POST');

$body = new http\Message\Body;
$body->append('{
    "redirectUri":"https://your.redirect.uri/monpay/invoice_web_hook",
    "amount":1,
    "receiver":"your_branch_username",
    "invoiceType":"P2B",
    "description":"Demo App SMS"
}');
$request->setBody($body);
$request->setOptions(array());

$request->setHeaders(array(
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer (your token)'
));

$client->enqueue($request)->send();

$response = $client->getResponse();
echo $response->getBody();
                
            
                
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");

RequestBody body = RequestBody.create(mediaType, "{
    "redirectUri":"https://your.redirect.uri/monpay/invoice_web_hook",
    "amount":1,
    "receiver":"your_branch_username",
    "invoiceType":"P2B",
    "description":"Demo App SMS"
}");

Request request = new Request.Builder()
  .url("https://z-wallet.monpay.mn/v2/api/oauth/invoice")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Accept", "application/json")
  .addHeader("Authorization", "Bearer (your token)")
  .build();

Response response = client.newCall(request).execute();
                
            
Method POST
URL https://z-wallet.monpay.mn/v2/api/oauth/invoice
Content-Type application/json
Accept application/json
Authorization Bearer auth {Access token generated from previous request}
Request
Parameters Type Description
amount double Amount
redirectUri string Webhook that will receive transaction result, schema and host must be match app registered redirectUri (refer to information)
clientServiceUrl string Your backend webhook url (GET method) that will be called after successful transaction.
receiver string Receiver value depends on invoiceType.
  • P2B -> Branch username that to sell product
  • P2P -> Customer accountNo that receive invoiced amount
  • B2B -> Organization name
invoiceType Enum
 (P2B, P2P, B2B)
  • P2B -> person to merchant
  • P2P -> person to person

  • B2B -> person to MF & MF to organization
description string Description
Response type
Parameters Type Description
code string Status description code
intCode integer Status code
info string Status info
result object Result object contains embedded parameter(s)
Result object parameters
Name Type Description
id integer Invoice unique id
receiver string Receiver value depends on invoiceType.
  • P2B -> Branch username that to sell product
  • P2P -> Customer accountNo that receive invoiced amount
  • B2B -> Organization name
amount double Amount
userId integer Pay user Id
miniAppId integer Mini app id
createDate date Invoice creation date
updateDate date Invoice updated date
status string “NEW”
description string Invoice description
redirectUri string redicrectUri that will make transaction complete, that should be opened on web browser.
invoiceType Enum (P2B, P2P, B2B)
  • P2B -> person to merchant
  • P2P -> person to person

  • B2B -> person to MF & MF to organization