Skip to content

Cancel Payment SNAP

Information

This API is requested from Merchant to the IFP during cancel payment.

Path/v1.0/qr/qr-mpm-cancel
HTTP MethodPOST
Service Code77

Request

Details
ParameterData TypeMandatoryLengthDescription
originalPartnerReferenceNoStringM64Original transaction identifier on service consumer system
originalReferenceNoStringM64Original transaction identifier on service provider system
reasonStringM256Reason cancellation
additionalInfoObjectMAdditional information
additionalInfo.typeStringMQR Type. The value is DYNAMIC

Example Request

sh
curl --location '.../v1.0/qr/qr-mpm-cancel' \
--header 'Content-Type: application/json' \
--header 'X-TIMESTAMP: 2020-12-23T08:10:11+07:00' \
--header 'X-SIGNATURE: 85be817c55b2c135157c7e89f52499bf0c25ad6eeebe04a986e8c862561b19a5' \
--header 'X-PARTNER-ID: IFP2024067944' \
--header 'X-EXTERNAL-ID: 41807553358950093184162180797837' \
--header 'CHANNEL-ID: QR004' \
--data '{
           "originalPartnerReferenceNo": "2020102900000000000001",
           "originalReferenceNo": "2020102977770000000009",
           "reason": "cancel reason",
           "additionalInfo": {
               "type": "DYNAMIC"
           }
         }'
go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := ".../v1.0/qr/qr-mpm-cancel"
  method := "POST"

  payload := strings.NewReader(`{
           "originalPartnerReferenceNo": "2020102900000000000001",
           "originalReferenceNo": "2020102977770000000009",
           "reason": "cancel reason",
           "additionalInfo": {
               "type": "DYNAMIC"
           }
         }`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("X-TIMESTAMP", "2020-12-23T08:10:11+07:00")
  req.Header.Add("X-SIGNATURE", "85be817c55b2c135157c7e89f52499bf0c25ad6eeebe04a986e8c862561b19a5")
  req.Header.Add("X-PARTNER-ID", "IFP2024067944")
  req.Header.Add("X-EXTERNAL-ID", "41807553358950093184162180797837")
  req.Header.Add("CHANNEL-ID", "QR004")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
js
const axios = require('axios');
let data = JSON.stringify({
  "originalPartnerReferenceNo": "2020102900000000000001",
  "originalReferenceNo": "2020102977770000000009",
  "reason": "cancel reason",
  "additionalInfo": {
    "type": "DYNAMIC"
  }
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: '.../v1.0/qr/qr-mpm-cancel',
  headers: { 
    'Content-Type': 'application/json', 
    'X-TIMESTAMP': '2020-12-23T08:10:11+07:00', 
    'X-SIGNATURE': '85be817c55b2c135157c7e89f52499bf0c25ad6eeebe04a986e8c862561b19a5', 
    'X-PARTNER-ID': 'IFP2024067944', 
    'X-EXTERNAL-ID': '41807553358950093184162180797837', 
    'CHANNEL-ID': 'QR004'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
rust
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("Content-Type", "application/json".parse()?);
    headers.insert("X-TIMESTAMP", "2020-12-23T08:10:11+07:00".parse()?);
    headers.insert("X-SIGNATURE", "85be817c55b2c135157c7e89f52499bf0c25ad6eeebe04a986e8c862561b19a5".parse()?);
    headers.insert("X-PARTNER-ID", "IFP2024067944".parse()?);
    headers.insert("X-EXTERNAL-ID", "41807553358950093184162180797837".parse()?);
    headers.insert("CHANNEL-ID", "QR004".parse()?);

    let data = r#"{
    "originalPartnerReferenceNo": "2020102900000000000001",
    "originalReferenceNo": "2020102977770000000009",
    "reason": "cancel reason",
    "additionalInfo": {
        "type": "DYNAMIC"
    }
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client.request(reqwest::Method::POST, ".../v1.0/qr/qr-mpm-cancel")
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => '.../v1.0/qr/qr-mpm-cancel',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
           "originalPartnerReferenceNo": "2020102900000000000001",
           "originalReferenceNo": "2020102977770000000009",
           "reason": "cancel reason",
           "additionalInfo": {
               "type": "DYNAMIC"
           }
         }',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'X-TIMESTAMP: 2020-12-23T08:10:11+07:00',
    'X-SIGNATURE: 85be817c55b2c135157c7e89f52499bf0c25ad6eeebe04a986e8c862561b19a5',
    'X-PARTNER-ID: IFP2024067944',
    'X-EXTERNAL-ID: 41807553358950093184162180797837',
    'CHANNEL-ID: QR004'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Response

Details
ParameterData TypeMandatoryLengthDescription
responseCodeStringM7Response code
responseMessageStringM150Response description
originalPartnerReferenceNoStringM64Original transaction identifier on service consumer system
originalReferenceNoStringM64Original transaction identifier on service provider system
cancelTimeStringC25Cancel time. ISO-8601. Must be filled if canceled transaction is successful
additionalInfoObjectMAdditional information
additionalInfo.typeStringMQR Type

Example Response

{
   "responseCode":"2007700",
   "responseMessage":"Request has been processed successfully",
   "originalPartnerReferenceNo":"2020102900000000000001",
   "originalReferenceNo":"2020102977770000000009",
   "cancelTime":"2020-10-20T17:56:57",
   "additionalInfo":{
       "type": "DYNAMIC"
   }
}

iFortepay API Documentation