Payments
All payments endpoints have path prefix /payments-service.
Example of main payments doc
{
"_id": "shping_payments_plans",
"currency": "aud",
"list": [
{
"id": "basic",
"name": "BASIC",
"cost": 0,
"hidden": false,
"commitment_period": 0,
"description": "Basic plan",
"modules": [],
"coin_rate": 0,
"upgrade_description": "You are currently on the Basic plan and have limited access to product analytics and promotional opportunities. Upgrade now!",
"description_list": [
{
"label": "GTIN",
"value": "Unlimited"
},
{
"label": "Product catalogue",
"value": true
},
{
"label": "Ingredients and Raw Materials",
"value": true
},
{
"label": "Availability Map",
"value": false
},
{
"label": "Engagement and Consumer Analytics",
"value": false
},
{
"label": "Reviews",
"value": false
},
{
"label": "Shoutouts",
"value": false
},
{
"label": "Shping bot",
"value": false
},
{
"label": "Rewards",
"value": false
},
{
"label": "Advanced Engagement (ToDo cards)",
"value": false
}
]
},
{
"id": "light",
"cost": 195,
"name": "LIGHT",
"hidden": false,
"coin_rate": 0.1,
"upgrade_description": "You are currently on the Light plan and have limited access to product analytics and promotional opportunities. Upgrade now!",
"description": "Lite plan",
"commitment_period": 52,
"modules": [
"product360",
"reviews"
],
"description_list": [
{
"label": "GTIN",
"value": "1-20"
},
{
"label": "Product catalogue",
"value": true
},
{
"label": "Ingredients and Raw Materials",
"value": true
},
{
"label": "Availability Map",
"value": true
},
{
"label": "Engagement and Consumer Analytics",
"value": true
},
{
"label": "Reviews",
"value": true
},
{
"label": "Shoutouts",
"value": false
},
{
"label": "Shping bot",
"value": false
},
{
"label": "Rewards",
"value": false
},
{
"label": "Advanced Engagement (ToDo cards)",
"value": false
}
]
},
{
"id": "pro",
"cost": 395,
"name": "PRO",
"description": "Standart plan",
"coin_rate": 0.2,
"hidden": false,
"commitment_period": 52,
"upgrade_description": "You are currently on the Pro plan and have limited access to product analytics and promotional opportunities. Upgrade now!",
"modules": [
"product360",
"reviews",
"rewards"
],
"description_list": [
{
"label": "GTIN",
"value": "21-500"
},
{
"label": "Product catalogue",
"value": true
},
{
"label": "Ingredients and Raw Materials",
"value": true
},
{
"label": "Availability Map",
"value": true
},
{
"label": "Engagement and Consumer Analytics",
"value": true
},
{
"label": "Reviews",
"value": true
},
{
"label": "Shoutouts",
"value": true
},
{
"label": "Shping bot",
"value": true
},
{
"label": "Rewards",
"value": true
},
{
"label": "Advanced Engagement (ToDo cards)",
"value": true
}
]
},
{
"id": "pro-corp",
"name": "PRO-CORP",
"description": "Pro plan",
"upgrade_description": "Corp-Pro is our top level, you already have access to all Shping's great features!",
"cost": 495,
"hidden": false,
"coin_rate": 0.3,
"commitment_period": 52,
"modules": [
"product360",
"reviews",
"livechat",
"rewards"
],
"description_list": [
{
"label": "GTIN",
"value": "501-999"
},
{
"label": "Product catalogue",
"value": true
},
{
"label": "Ingredients and Raw Materials",
"value": true
},
{
"label": "Availability Map",
"value": true
},
{
"label": "Engagement and Consumer Analytics",
"value": true
},
{
"label": "Reviews",
"value": true
},
{
"label": "Shoutouts",
"value": true
},
{
"label": "Shping bot",
"value": true
},
{
"label": "Rewards",
"value": true
},
{
"label": "Advanced Engagement (ToDo cards)",
"value": true
}
]
}
],
"type": "system_doc"
}
User card
Set the by token
PUT /payments-service/user/card/:token
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
TODO
Delete the card
DELETE /payments-service/user/card
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Read actual billing plans
Read this plans
GET /payments-service/billing_plans
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"currency": "aud",
"id": "shping_payments_plans",
"list": [
{
"commitment_period": 0,
"cost": 0,
"description": "Basic plan",
"description_list": {
"Advanced Engagement (ToDo cards)": false,
"Availability Map": false,
"Engagement and Consumer Analytics": false,
"GTIN": "Unlimited",
"Ingredients and Raw Materials": true,
"Product catalogue": true,
"Reviews": false,
"Rewards": false,
"Shoutouts": false,
"Shping bot": false
},
"hidden": false,
"id": "basic",
"modules": [],
"name": "BASIC",
"coin_rate": 0
},
{
"commitment_period": 52,
"cost": 195,
"description": "Lite plan",
"description_list": {
"Advanced Engagement (ToDo cards)": false,
"Availability Map": true,
"Engagement and Consumer Analytics": true,
"GTIN": "1-20",
"Ingredients and Raw Materials": true,
"Product catalogue": true,
"Reviews": true,
"Rewards": false,
"Shoutouts": false,
"Shping bot": false
},
"hidden": false,
"id": "light",
"modules": [
"product360",
"reviews"
],
"name": "LIGHT",
"coin_rate": 0.1
},
{
"commitment_period": 52,
"cost": 395,
"description": "Standart plan",
"description_list": {
"Advanced Engagement (ToDo cards)": true,
"Availability Map": true,
"Engagement and Consumer Analytics": true,
"GTIN": "21-500",
"Ingredients and Raw Materials": true,
"Product catalogue": true,
"Reviews": true,
"Rewards": true,
"Shoutouts": true,
"Shping bot": true
},
"hidden": false,
"id": "pro",
"modules": [
"product360",
"reviews",
"rewards"
],
"name": "PRO",
"coin_rate": 0.2
},
{
"commitment_period": 52,
"cost": 495,
"description": "Pro plan",
"description_list": {
"Advanced Engagement (ToDo cards)": true,
"Availability Map": true,
"Engagement and Consumer Analytics": true,
"GTIN": "501-999",
"Ingredients and Raw Materials": true,
"Product catalogue": true,
"Reviews": true,
"Rewards": true,
"Shoutouts": true,
"Shping bot": true
},
"hidden": false,
"id": "pro-corp",
"modules": [
"product360",
"reviews",
"livechat",
"rewards"
],
"name": "PRO-CORP",
"coin_rate": 0.3
}
]
}
Participant Billing Plan
Read Current Billing Plan
Retrieves active billing plan of current participant. Returns JSON with plan and payment card info.
GET /payments-service/participants/current/billing_plan
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"plan": "lite",
"card": {
"brand": "MasterCard",
"last4": "8210",
"exp_month": 12,
"exp_year": 2019,
"name": "JANE DOE"
}
}
Change Billing Plan
Change Billing Plan
Change active billing plan for current participant. Takes JSON object containing new plan name (basic, lite, standard or pro) and payment card information. For plans other than basic payment card is required. Payment card details may be specified directly (card
object must contain number
, exp_year
, exp_month
and cvc
) or by means of a card token generated on client side (card
object must contain nonce
token). Card token generation is the preferred method, it's payment service provider dependent. Currently server uses Stripe for actual payment processing (see https://stripe.com/docs/stripe-js for client side library).
The default modules for plans:
* basic - hasn't active modules;
* lite has product360 and reviews;
* standard has product360, reviews, rewards;
* pro has product360, reviews, chat, rewards.
The default modules may be set in sys.config. The participant can upgrade the plan at any time. The plan can only be downgraded after 52 weeks of using the current plan. When the plan is changed, the payment is recalculated and fees for used rewards campaign coins. The coins will be convert to сurrency depending on the plan:
* lite - 1point = 0.1 (usd);
* standard - 1point = 0.2 (usd);
* pro - 1point = 0.3 (usd).
The actual currency may be set in sys.config. Default is usd. Payment depends of the participant's plan:
* basic - 0;
* lite - 195;
* standard - 395;
* pro - 495.
PUT /payments-service/participants/current/billing_plan
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Request
{
"plan": "standard",
"card": {
"number": "5200828282828210",
"exp_month": 12,
"exp_year": 2019,
"name": "JANE DOE",
"cvc": 323
}
}
Set email for user's notification
User, who was activate the billing plan (or set new card) can set/remove additionals emails for receiving notifications.
PUT /payments-service/participants/notifications/email
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
email |
|
Email (“foo@bar.com”) - optional |
user_id |
|
User ID (“urn:authenticateit:user:email:foo@bar.com”) - optional. If id is user_id then email will be read from user profile |
Example Response
[
"some_user@gmail.com",
"foo@bar.com",
"foo1@bar.com"
]
Remove email
POST /payments-service/participants/notifications/delete_email
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
email |
string |
Email |
Example Response
[
"some_user@gmail.com",
"foo1@bar.com"
]
Get participant payment history
API to read payment history of current participant. Returns JSON list of history entries. Each entry has timestamp ts, type of the payment in payment_type field (either subscription or rewards), amount field and card object field. Card object has last four digits of the card number in the last4 field.
GET /payments-service/participants/current/payment_history
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
[
{
"card_barnd": "MasterCard",
"card_exp_month": 12,
"card_exp_year": 2019,
"card_last4": "8210",
"card_name": "JANE DOE",
"currency": "usd",
"rows": [
{
"amount": "395.00",
"description": "Selected plan - \"standard\". Paid period: from 2017-03-24 to 2017-04-24"
},
{
"amount": "20.00",
"description": "Used rewards coins. Paid period: from 2017-03-24 to 2017-04-24"
}
],
"status": "Payment successful",
"summary_amount": "415.00",
"ts": "2017-04-23T21:10:03Z"
}
]
Participant Ethereum Account
Read Ethereum Account
Retrieves Ethereum account information of current participant. Returns
JSON with address
field (checksum encoded Ethereum address). If
participant has no Ethereum account configured, address
may be
null
or missing in the response.
GET /payments-service/participants/current/ethereum
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"address": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
}
Update Ethereum Account
Change Ethereum account information of current participant. Accepts
JSON object with field address
(Ethereum address, or null
to clear
the address). Responds with updated participant's Ethereum account
information. Participant must have no active reward campaigns to
change Ethereum address.
PUT /payments-service/participants/current/ethereum
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Request
{
"address": null
}
User's Ethereum addresses
Get user's balance
GET /payments-service/user/ethereum/balance
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"account_coins": "1949979999999999999934",
"balance_coins": "10111020000000000000000",
"coins_fee": {
"max": "50000000000000000000",
"min": "1000000000000000000"
},
"total_coins": "12060999999999999999934"
}
Return parameters
Name |
Description |
account_coins |
Coins from user's profile |
balance_coins |
Coins from all user's addresses |
total_coins |
account_coins + account_coins |
coins_fee |
Min and Max values for transaction fee parameter |
Transfer coins method
POST /payments-service/user/ethereum/transfer
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
address |
body |
Required: Ethereum address |
coins |
body |
Required: Coins value |
fee |
body |
Required: Price for transfer in coins |
Example Request
{"address":"0xe40555b43d60656b9510860A11D6bDCDDb8E78A2", "coins":"9000000000000000000", "fee":"1000000000000000000"}
Example Response
{
"address": "0xe40555b43d60656b9510860A11D6bDCDDb8E78A2",
"coins": "9000000000000000000",
"fee": "1000000000000000000",
"hash": null,
"id": "urn:authenticateit:transaction_request:9f5885f7-b013-440c-b86e-a247fc8d6ba2",
"status": "pending",
"ts": "2018-03-08T09:16:49Z"
}
Read transfers history
GET /payments-service/user/ethereum/transfer/history
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"history": [
{
"address": "0xe40555b43d60656b9510860A11D6bDCDDb8E78A2",
"coins": "9000000000000000000",
"fee": "1000000000000000000",
"hash": "0x44e77e7529d4cb3d1192dff2fe6f1f9b79411c27aa907ae3fb67d645a53bb48a",
"id": "urn:authenticateit:transaction_request:d89a1fa3-caf4-4e12-b984-22a42b058b35",
"status": "pending",
"ts": "2018-03-08T09:32:00Z"
},
{
"address": "0xe40555b43d60656b9510860A11D6bDCDDb8E78A2",
"coins": "9000000000000000000",
"fee": "1000000000000000000",
"hash": null,
"id": "urn:authenticateit:transaction_request:9f5885f7-b013-440c-b86e-a247fc8d6ba2",
"status": "failure",
"ts": "2018-03-08T09:24:00Z"
}
]
}
Get user's ethereum addresses
GET /payments-service/user/ethereum/addresses
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
Example Response
{
"list": [
{
"address": "0x189050cCB230595ce8376A9606319cD906B29A0f",
"ts": "2018-02-15T09:10:50Z"
}
]
}
Remove user's coupled addresses
PUT /payments-service/user/ethereum/addresses/remove
Parameters
Name |
Type |
Description |
authenticateit_identity_ticket |
header |
Required: Session's ticket |
list |
array::string |
Required: list of addresses |
Example Request
{"list": ["0x189050cCB230595ce8376A9606319cD906B29A0f"] }
Example Response
{
"list": []
}
Manual transfer approving
Information on pending transfer will be emailed to a moderator (moderators) who will either approve or reject transfer by clicking on approve/reject links. URLs to approve or reject pending transfer are /user/ethereum/transfer/:code/approve and /user/ethereum/transfer/:code/reject.
Approve transfer
GET /user/ethereum/transfer/:code/approve
Parameters
Name |
Type |
Description |
code |
body |
Required: Code UUID |
Reject transfer
GET /user/ethereum/transfer/:code/reject
Parameters
Name |
Type |
Description |
code |
body |
Required: Code UUID |