# Create Transaction

# Request

# Basic

URL API:

https://mypaynz.com/api/v3/payment
  1. Request method: POST
  2. Parameter method: Form URL-Encoded
  3. Set Content-Type: 'Content-Type: application/json;X-Requested-With=XMLHttpRequest'

# Parameter

Parameter Type Nullable Signature Required Desc
mid int(4) No Yes Merchant Id, Register (opens new window)
amount int(10) No Yes Amount, Unit: Cent
currency NZD No Yes Currency please use NZD
goods string(64) No Yes Item name, must not contain any special characters
goods_detail string(128) No Yes Item descripion, must not contain any special characters
out_trade_no string(64) No Yes Order number, should be unique, recommend using date(YYYYmmddHHiiss) + 18 digit random number
pay_type string(8) No Yes Support Payment Type
return_url string(512) No Yes After the payment is done, the result is returned to this url via the URL redirect.
notify_url string(512) No Yes The URL for receiving asynchronous notifications after the payment is done.
is_mobile true,false Yes No Transaction happend in mobile phone, ONLY required when paytype is union pay.
openid string(30) Yes No Wechat open ID, ONLY required when paytype is wechat mini.
mini_appid string(20) Yes No Wechat mini program Id, ONLY required when paytype is wechat mini.
sign_type MD5, SHA256 No No The signature you want to use. signature
sign string(32) No No signature

Example

  • Curl
  • PHP
  • Golang
  • JavaScript
  • Java

curl --location --request POST 'https://mypaynz.com/api/v3/payment' \
    --form 'mid="11585"' \
    --form 'amount="1"' \
    --form 'currency="NZD"' \
    --form 'goods="test"' \
    --form 'goods_detail="test 1"' \
    --form 'out_trade_no="20220518012"' \
    --form 'pay_type="IE0012"' \
    --form 'sign="THISJUSTATEST"' \
    --form 'sign_type="MD5"' \
    --form 'return_url="http://test.com/return"' \
    --form 'notify_url="http://test.com/notify"' \

# Response

# Successes

{
    "success": true,
    "status": true,
    "error_code": 0,
    "message": "OK",
    "data": {
        "pay_type": "IE0012",
        "pay_type_str": "Alipay Web",
        "out_trade_no": "20220518012",
        "trade_no": null,
        "amount": 1,
        "status": 0,
        "status_str": "Unpay",
        "pay_url": "https://alipay.com/payment/url"
    }
}

# Already Exist

{
    "success": false,
    "status": false,
    "error_code": 0,
    "message": "This order alreade exist.",
    "data": {
        "pay_type": "IE0012",
        "pay_type_str": "Alipay Web",
        "out_trade_no": "20220518012",
        "trade_no": null,
        "amount": 1,
        "status": 0,
        "status_str": "Unpay",
        "pay_url": "https://alipay.com/payment/url"
    }
}

# Error

Signature Error

{
    "success": false,
    "status": false,
    "error_code": 104,
    "message": "The signature is not matched.",
    "data": []
}

Params Error

{
    "success": false,
    "status": false,
    "error_code": 102,
    "message": "The parameters are invalid.",
    "data": {
        "mid": [
            "The mid field is required."
        ]
    }
}

# Query Transaction

# Request

# Basic

URL API:

https://mypaynz.com/api/v3/query
  1. Request method: GET
  2. Parameter method: Form URL-Encoded
  3. Set Content-Type: 'Content-Type: application/json;X-Requested-With=XMLHttpRequest'

# Parameter

Parameter Type Nullable Signature Required Desc
mid int(4) No Yes Merchant Id, Register (opens new window)
out_trade_no string(64) No Yes Order number, should be unique, recommend using date(YYYYmmddHHiiss) + 18 digit random number
sign_type MD5, SHA256 No No The signature you want to use. signature
sign string(32) No No signature

Examples

  • Curl
  • PHP
  • Golang
  • JavaScript
  • Java

## Create transaction  类似
curl --location --request GET 'https://mypaynz.com/api/v3/query?mid=11585&out_trade_no=20220518012&sign=THISJUSTATEST&sign_type=MD5' \
--header 'Content-Type: application/json' \
--header 'X-Requested-With: XMLHttpRequest'

# Response

# Successes

{
    "success": true,
    "status": true,
    "error_code": 0,
    "message": "OK",
    "data": {
        "pay_type": "IE0012",
        "pay_type_str": "Alipay Web",
        "out_trade_no": "20220518012",
        "trade_no": null,
        "amount": 1,
        "status": 0,
        "status_str": "Unpay",
        "refunded_amount": 0,
        "pay_url": "https://alipay.com/payment/url"
    }
}

# Error

Signature Error

{
    "success": false,
    "status": false,
    "error_code": 104,
    "message": "The signature is not matched.",
    "data": []
}

Params Error

{
    "success": false,
    "status": false,
    "error_code": 102,
    "message": "The parameters are invalid.",
    "data": {
        "mid": [
            "The mid field is required."
        ]
    }
}

# Refund Transaction

# Request

# Basic

URL API:

https://mypaynz.com/api/v3/refund
  1. Request method: POST
  2. Parameter method: Form URL-Encoded
  3. Set Content-Type: 'Content-Type: application/json;X-Requested-With=XMLHttpRequest'

# Parameter

Parameter Type Nullable Signature Required Desc
mid int(4) No Yes Merchant Id, Register (opens new window)
amount int(10) No Yes Amount, Unit: Cent
out_trade_no string(64) No Yes Order number, should be unique, recommend using date(YYYYmmddHHiiss) + 18 digit random number
sign_type MD5, SHA256 No No The signature you want to use. signature
sign string(32) No No signature

Examples

  • Curl
  • PHP
  • Golang
  • JavaScript
  • Java

## Create transaction 
curl --location --request POST 'https://mypaynz.com/api/v3/refund' \
    --form 'mid="11585"' \
    --form 'amount="1"' \
    --form 'out_trade_no="20220518012"' \
    --form 'sign="THISJUSTATEST"' \
    --form 'sign_type="MD5"'

# Response

# Successes

{
    "success": true,
    "status": true,
    "error_code": 0,
    "message": "OK",
    "data": {
        "pay_type": "IE0012",
        "pay_type_str": "Alipay Web",
        "out_trade_no": "20220518012",
        "trade_no": "origin_trade_no",
        "amount": 1,
        "status": 2,
        "status_str": "Refund",
        "refunded": 1
    }
}

# Error

Signature Error

{
    "success": false,
    "status": false,
    "error_code": 104,
    "message": "The signature is not matched.",
    "data": []
}

Params Error

{
    "success": false,
    "status": false,
    "error_code": 102,
    "message": "The parameters are invalid.",
    "data": {
        "mid": [
            "The mid field is required."
        ]
    }
}