Phriction DatingVIP Public Payment Application Paypal Rest Payment Api Calls Examples History Version 1 vs 2
Version 1 vs 2
Version 1 vs 2
Content Changes
Content Changes
Using Paypal Rest processor (PR) is very similar to older Paypal processor (PP), thus switch from the older to newer version should not be a problem. All the differences should take place in the backend of payment app, because of the change of old paypal NVP api to the new rest api.
Here is the list of common calls:
**1. transaction.init**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.init",
"data": {
"tracking_company": "1",
"tracking_user": "18080627",
"tracking_tag": "3213",
"zipcode": "85035",
"country": "US",
"email": "dogj0490@gmail.com",
"first_name": "rino692u",
"last_name": "",
"ip": "172.69.34.183",
"host": "172.69.34.183",
"currency": "USD",
"pp_type": "PR",
"tax_rate": "0",
"tax_amount": "0",
"items": [
{
"tracking_item": "186",
"amount": "29.99",
"description": "$3.49 5 Day trial rebills at $29.99 per month*",
"rebill_unit": "month",
"rebill_period": "1",
"trial_amount": "3.49",
"trial_unit": "day",
"trial_period": "5",
"max_rebill_count": "-1"
}
],
"order_type": "",
"cancel_url": "https:\/\/www.cosplaydatingsite.com\/payment\/cancel",
"return_url": "https:\/\/www.cosplaydatingsite.com\/payment\/finish"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
```
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.init",
"result": {
"hash": "161252520590129a48aad3ebd1e603a0",
"redirect": "https:\/\/www.paypal.com\/webapps\/billing\/subscriptions?ba_token=BA-25032222MM8175034"
},
"request": {
"cmd": "transaction.init",
"data": {
"tracking_company": "1",
"tracking_user": "18080627",
"tracking_tag": "3213",
"zipcode": "85035",
"country": "US",
"email": "dogj0490@gmail.com",
"first_name": "rino692u",
"last_name": "",
"ip": "172.69.34.183",
"host": "172.69.34.183",
"currency": "USD",
"pp_type": "PR",
"tax_rate": "0",
"tax_amount": "0",
"items": [
{
"tracking_item": "186",
"amount": "29.99",
"description": "$3.49 5 Day trial rebills at $29.99 per month*",
"rebill_unit": "month",
"rebill_period": "1",
"trial_amount": "3.49",
"trial_unit": "day",
"trial_period": "5",
"max_rebill_count": "-1"
}
],
"order_type": "",
"cancel_url": "https:\/\/www.cosplaydatingsite.com\/payment\/cancel",
"return_url": "https:\/\/www.cosplaydatingsite.com\/payment\/finish"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525206,
"origin_ip": "10.3.3.35",
"errors": null
}
```
**2. transaction.finish**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.finish",
"data": {
"pp_type": "pr",
"hash": "16125250428952274a271d211a24edad"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
```
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.finish",
"result": {
"success": true,
"payment_tran_id": 177184973,
"items_data": [
{
"item_id": "77879453",
"order_id": "77844313",
"tracking_item": "157"
}
]
},
"request": {
"cmd": "transaction.finish",
"data": {
"pp_type": "pr",
"hash": "16125250428952274a271d211a24edad"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525106,
"origin_ip": "10.3.3.35",
"errors": null
}
```
**3. transaction.refund**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.refund",
"data": {
"sub_id": "32351833",
"tran_id": "177120903",
"pp_type": "PR",
"limit": "50"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.refund",
"result": {
"success": true,
"tran_id": 177148543
},
"request": {
"cmd": "transaction.refund",
"data": {
"sub_id": "32351833",
"tran_id": "177120903",
"pp_type": "PR",
"limit": "50"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612496456,
"origin_ip": "10.3.3.19",
"errors": null
}
**4. subscription.cancel**
//request://
{
"c": "api",
"a": ".json",
"cmd": "subscription.cancel",
"data": {
"sub_id": "32364543",
"tran_id": "1",
"pp_type": "PR",
"passback": {
"flags": [
"skip_subscription_stopped_notification"
]
},
"limit": "50"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
//response://
{
"code": 700,
"status": "Action completed successfully",
"command": "subscription.cancel",
"result": {
"success": true
},
"request": {
"cmd": "subscription.cancel",
"data": {
"sub_id": "32364543",
"tran_id": "1",
"pp_type": "PR",
"passback": {
"flags": [
"skip_subscription_stopped_notification"
]
},
"limit": "50"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525888,
"origin_ip": "10.3.3.174",
"errors": null
}
Using Paypal Rest processor (PR) is very similar to older Paypal processor (PP), thus switch from the older to newer version should not be a problem. All the differences should take place in the backend of payment app, because of the change of old paypal NVP api to the new rest api.
Here is the list of common calls:
**1. transaction.init**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.init",
"data": {
"tracking_company": "1",
"tracking_user": "18080627",
"tracking_tag": "3213",
"zipcode": "85035",
"country": "US",
"email": "dogj0490@gmail.com",
"first_name": "rino692u",
"last_name": "",
"ip": "172.69.34.183",
"host": "172.69.34.183",
"currency": "USD",
"pp_type": "PR",
"tax_rate": "0",
"tax_amount": "0",
"items": [
{
"tracking_item": "186",
"amount": "29.99",
"description": "$3.49 5 Day trial rebills at $29.99 per month*",
"rebill_unit": "month",
"rebill_period": "1",
"trial_amount": "3.49",
"trial_unit": "day",
"trial_period": "5",
"max_rebill_count": "-1"
}
],
"order_type": "",
"cancel_url": "https:\/\/www.cosplaydatingsite.com\/payment\/cancel",
"return_url": "https:\/\/www.cosplaydatingsite.com\/payment\/finish"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
```
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.init",
"result": {
"hash": "161252520590129a48aad3ebd1e603a0",
"redirect": "https:\/\/www.paypal.com\/webapps\/billing\/subscriptions?ba_token=BA-25032222MM8175034"
},
"request": {
"cmd": "transaction.init",
"data": {
"tracking_company": "1",
"tracking_user": "18080627",
"tracking_tag": "3213",
"zipcode": "85035",
"country": "US",
"email": "dogj0490@gmail.com",
"first_name": "rino692u",
"last_name": "",
"ip": "172.69.34.183",
"host": "172.69.34.183",
"currency": "USD",
"pp_type": "PR",
"tax_rate": "0",
"tax_amount": "0",
"items": [
{
"tracking_item": "186",
"amount": "29.99",
"description": "$3.49 5 Day trial rebills at $29.99 per month*",
"rebill_unit": "month",
"rebill_period": "1",
"trial_amount": "3.49",
"trial_unit": "day",
"trial_period": "5",
"max_rebill_count": "-1"
}
],
"order_type": "",
"cancel_url": "https:\/\/www.cosplaydatingsite.com\/payment\/cancel",
"return_url": "https:\/\/www.cosplaydatingsite.com\/payment\/finish"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525206,
"origin_ip": "10.3.3.35",
"errors": null
}
```
**2. transaction.finish**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.finish",
"data": {
"pp_type": "pr",
"hash": "16125250428952274a271d211a24edad"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
```
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.finish",
"result": {
"success": true,
"payment_tran_id": 177184973,
"items_data": [
{
"item_id": "77879453",
"order_id": "77844313",
"tracking_item": "157"
}
]
},
"request": {
"cmd": "transaction.finish",
"data": {
"pp_type": "pr",
"hash": "16125250428952274a271d211a24edad"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525106,
"origin_ip": "10.3.3.35",
"errors": null
}
```
**3. transaction.refund**
//request://
```
{
"c": "api",
"a": ".json",
"cmd": "transaction.refund",
"data": {
"sub_id": "32351833",
"tran_id": "177120903",
"pp_type": "PR",
"limit": "50"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
```
//response://
{
"code": 700,
"status": "Action completed successfully",
"command": "transaction.refund",
"result": {
"success": true,
"tran_id": 177148543
},
"request": {
"cmd": "transaction.refund",
"data": {
"sub_id": "32351833",
"tran_id": "177120903",
"pp_type": "PR",
"limit": "50"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612496456,
"origin_ip": "10.3.3.19",
"errors": null
}
**4. subscription.cancel**
//request://
{
"c": "api",
"a": ".json",
"cmd": "subscription.cancel",
"data": {
"sub_id": "32364543",
"tran_id": "1",
"pp_type": "PR",
"passback": {
"flags": [
"skip_subscription_stopped_notification"
]
},
"limit": "50"
},
"ptnr_id": "1",
"token": "<partner_token>",
"pass": "<partner_password>"
}
//response://
{
"code": 700,
"status": "Action completed successfully",
"command": "subscription.cancel",
"result": {
"success": true
},
"request": {
"cmd": "subscription.cancel",
"data": {
"sub_id": "32364543",
"tran_id": "1",
"pp_type": "PR",
"passback": {
"flags": [
"skip_subscription_stopped_notification"
]
},
"limit": "50"
},
"token": "<partner_token>",
"pass": "<partner_password>"
},
"ts": 1612525888,
"origin_ip": "10.3.3.174",
"errors": null
}