Billing API documentation version v2
https://client-api.{environment}/api/billing/v2
- environment: required (one of magine.com, tvoli.com - default: magine.com)
/users/{userId}
Get active payment method.
get /users/{userId}/payment_method
Get active payment method.
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {token}
Example:
Bearer 4b6fbf80...
HTTP status code 200
Payment method
Body
Media type: application/json
Type: object
Properties- method: required (one of paypal, credit_card)
- provider: required (string)
- data: required (object)
- ccMaskedNumber: (string)
- ccExpYear: (integer)
- ccExpMonth: (integer)
- ccCardholderName: (string)
- ccFinancialInstitution: (string)
Example:
{
"method":"credit_card",
"provider":"adyen",
"data":{
"ccCardholderName":"Bob",
"ccMaskedNumber":"************1111",
"ccExpYear":2020,
"ccExpMonth":10,
"ccFinancialInstitution":"visa"
}
}
HTTP status code 404
No active payment method
Payment with existing payment method
post /users/{userId}/payments/reference
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {token}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
- netPrice: (integer)
- promoCode: (string)
HTTP status code 200
Successful payment
Body
Media type: application/json
Type: object
Properties- userId: required (string)
- transactionId: required (string)
- status: required (string)
- transactionType: required (string)
- paymentMethod: required (string)
- fromDate: required (integer)
- toDate: required (integer)
- productIds: required (array of string)
- grossPrice: required (integer)
- netPrice: required (integer)
- currency: required (string)
- timestamp: required (integer)
- productNames: required (array of string)
- errorMessage: (string)
- rawResponse: (string)
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 402
Failed payment
Body
Media type: application/json
Type: object
Properties- userId: required (string)
- transactionId: required (string)
- status: required (string)
- transactionType: required (string)
- paymentMethod: required (string)
- fromDate: required (integer)
- toDate: required (integer)
- productIds: required (array of string)
- grossPrice: required (integer)
- netPrice: required (integer)
- currency: required (string)
- timestamp: required (integer)
- productNames: required (array of string)
- errorMessage: (string)
- rawResponse: (string)
User history of added and canceled subscriptions
get /users/{userId}/payments
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
HTTP status code 200
OK
Body
Media type: application/json
Type: any
Example:
[
{
"userId":"8ZP39MIL3L1A8G7NOISIFJCG3USR",
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"currency":"SEK",
"fromDate":1481897926324,
"grossPrice":2900,
"netPrice":2900,
"paymentMethod":"paypal",
"productIds":["00006SEPAC"],
"productName":["News"],
"status":"initial",
"timestamp":1481897926324,
"toDate":1484576326324,
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"transactionType":"registration"
},
{
"userId":"8ZP39MIL3L1A8G7NOISIFJCG3USR",
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"currency":"SEK",
"fromDate":1481897926324,
"grossPrice":2900,
"netPrice":2900,
"paymentMethod":"paypal",
"productIds":["00006SEPAC"],
"productName":["News"],
"status":"success",
"timestamp":1481897926324,
"toDate":1484576326324,
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"transactionType":"registration"
}
]
User history of added and canceled subscriptions, only shows the last entry for each transaction
get /users/{userId}/payments/aggregate
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
HTTP status code 200
OK
Body
Media type: application/json
Type: any
Example:
[
{
"userId":"8ZP39MIL3L1A8G7NOISIFJCG3USR",
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"currency":"SEK",
"fromDate":1481897926324,
"grossPrice":2900,
"netPrice":2900,
"paymentMethod":"paypal",
"productIds":["00006SEPAC"],
"productName":["News"],
"status":"success",
"timestamp":1481897926324,
"toDate":1484576326324,
"transactionId":"7E9Q7LSCS3G2H3LBA9UQEL2J1PTI",
"transactionType":"registration"
}
]
Initiate a paypal payment, and get an url to Paypal payment site
post /users/{userId}/adyen/init-paypal
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {token}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
- netPrice: (integer)
- promoCode: (string)
Get a redirect URL for Adyen hosted payment page (HPP)
post /users/{userId}/adyen/init
URI Parameters
- userId: required (string)
Example:
007T1RQUSR
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {token}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
- netPrice: (integer)
- promoCode: (string)
Purchase a billing JWT
Perform a verified purchase with a billing JWT
post /adyen/purchase-jwt
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {token}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- billingJwt: required (string)
A Billing JWT gotten from e.g. the offer service
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- transactionId: required (string)
- paymentStatus: required (one of initial, success, pending, failed)
- redirectUrl: required (string)
Adyen HPP redirect URL.