Skip to content

UserPaymentMethod API

Register new credit card using Nets Payment Service Provider

Section titled “Register new credit card using Nets Payment Service Provider”

The registering of a new credit card using the Nets payment integration, consists of an initialize request and entering of card info, followed by an external callback from Nets.

A new credit card is initialized using the following:

curl --location --request POST 'http://{api-domain}/api/web/user/{userId}/userpaymentmethod' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{bearerToken}}' \
--header 'Accept: application/json;v=3' \
--data-raw '{
"userPaymentMethod": {
"userId": {userId},
"paymentProviderId": {payment provider id},
"callbackUrl": "https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback"
}
}'

Example response

{
"id": "b350c459-7be7-4477-8819-0b6e2bbdb7b9",
"userId": 10040,
"registered": "2020-01-20T14:29:51Z",
"userPaymentMethodStatus": "INITIALIZE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"paymentProviderId": 41,
"redirectUrl": "{Nets redirect url}"
}

The url present in redirectUrl is a link to a nets window where end user should enter the credit card information. Once done, Nets will validate the credit card and make a callback to the callbackUrl sent in the initialize request. The Vimond API then makes a verify request towards Nets. The callback request from Nets will typically look something like this:

curl --location --request GET 'https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback?transactionId={nets transaction ID}&responseCode={nets response code}&userPaymentMethodId=b350c459-7be7-4477-8819-0b6e2bbdb7b9' \
--header 'Accept: application/xml'

Example response

<userPaymentMethod>
<allowOneClickBuy>true</allowOneClickBuy>
<captureAttemptLog>Nets responseCode: OK</captureAttemptLog>
<expirationDate>2020-12-20T00:00:00Z</expirationDate>
<expireDate>2020-12-20T00:00:00Z</expireDate>
<extAgreementRef>random</extAgreementRef>
<id>b350c459-7be7-4477-8819-0b6e2bbdb7b9</id>
<paymentInfo>1111 11** **** 1111</paymentInfo>
<paymentProviderId>41</paymentProviderId>
<registered>2020-01-20T14:29:51Z</registered>
<userId>10040</userId>
<userPaymentMethodStatus>ACTIVE</userPaymentMethodStatus>
<userPaymentMethodType>CREDIT_CARD</userPaymentMethodType>
</userPaymentMethod>

Register new credit card using Dibs Payment Service Provider

Section titled “Register new credit card using Dibs Payment Service Provider”

Register new credit card using Altapay Payment Service Provider

Section titled “Register new credit card using Altapay Payment Service Provider”

The registering of a new credit card using the Altapay payment integration, consists of an initialize request and entering of card info, followed by an external callback from Altapay.

A new credit card is initialized using the following:

curl --location --request POST 'http://{api-domain}/api/web/user/{userId}/userpaymentmethod' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {bearerToken}' \
--header 'Accept: application/json;v=3' \
--data-raw '{
"userPaymentMethod": {
"userId": {userId},
"paymentProviderId": {payment provider id},
"callbackUrl": "https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback"
}
}'

Example response

{
"id": "b350c459-7be7-4477-8819-0b6e2bbdb7b9",
"userId": 10041,
"registered": "2020-01-20T14:29:51Z",
"userPaymentMethodStatus": "INITIALIZE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"paymentProviderId": 22,
"redirectUrl": "{Altapay redirect url}"
}

The url present in redirectUrl is a link to an Altapay window where end user should enter the credit card information. Once done, Altapay will validate the credit card and make a callback to the callbackUrl sent in the initialize request. The Vimond API then makes a verify request towards Altapay. The callback request from Altapay will typically look something like this:

curl --location --request POST 'https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback?transactionId={nets transaction ID}&responseCode={nets response code}&userPaymentMethodId=b350c459-7be7-4477-8819-0b6e2bbdb7b9' \
--header 'Content-Type: application/x-www-form-urlencoded'\
--data-urlencode 'transaction_id={Altapay transaction Id}'\
--data-urlencode 'credit_card_token={Altapay credit card token}'
--data-urlencode 'amount={amount}'\
--data-urlencode 'nature=CreditCard'\
--data-urlencode 'payment_status=recurring_confirmed'\
--data-urlencode 'transaction_info[base_url]={api-domain}/api'\
--data-urlencode 'type={payment type - typically subscription}'\
--data-urlencode 'blacklist_token={Altapay blacklist_token}'\
--data-urlencode 'embedded_window=0'\
--data-urlencode 'require_capture=false'\
--data-urlencode 'avs_text={some text}'\
--data-urlencode 'masked_credit_card={masked card number}'\
--data-urlencode 'payment_id={Altapay payment Id}'\
--data-urlencode 'avs_code={Altapay avs code}'\
--data-urlencode 'xml={large xml containing transaction info}'\
--data-urlencode 'checksum={Altapay checksum}'\
--data-urlencode 'transaction_info[reset_url]={api-domain}/api'\
--data-urlencode 'currency={Altapay currency code}'\
--data-urlencode 'shop_orderid={Vimond order id}'\
--data-urlencode 'status=succeeded'

Example response

<userPaymentMethod>
<allowOneClickBuy>true</allowOneClickBuy>
<captureAttemptLog>AltaPay status: succeeded, recurring_confirmed</captureAttemptLog>
<expireDate>2021-01-01T00:00:00Z</expireDate>
<extAgreementRef>35549552</extAgreementRef>
<id>b350c459-7be7-4477-8819-0b6e2bbdb7b9</id>
<paymentInfo>758639******2932</paymentInfo>
<paymentProviderId>22</paymentProviderId>
<registered>2020-01-20T14:29:51Z</registered>
<userId>10041</userId>
<userPaymentMethodStatus>ACTIVE</userPaymentMethodStatus>
<userPaymentMethodType>CREDIT_CARD</userPaymentMethodType>
</userPaymentMethod>

Register new credit card/paypal account using Braintree Payment Service Provider

Section titled “Register new credit card/paypal account using Braintree Payment Service Provider”

Vimonds Braintree Payment Provider supports registering of both credit cards and paypal accounts. The flow consists of an initialize -and a capture call that must be made from a portal/app.

A new Braintree userPaymentMethod is initialized using the following example

curl --location --request POST 'https://{api-domain}/api/web/user/{userId}/userpaymentmethod' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;v=3' \
--header 'Authorization: Bearer {bearerToken}' \
--data-raw '{
"userPaymentMethod": {
"userId": {userid},
"paymentProviderId": {payment providerid},
"callbackUrl": "https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback"
}
}'

Example response

{
"id": "9264499f-cb2f-4a1f-b720-61e2afabd45e",
"userId": 10014,
"registered": "2020-01-24T11:55:16Z",
"userPaymentMethodStatus": "INITIALIZE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"paymentProviderId": 61,
"callbackUrl": "https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback"
}

The userPaymentMethod is captured using the following example:

curl --location --request GET 'https://{api-domain}/api/web/user/{userId}/userpaymentmethod/callback?nonce={payment nonce}&userPaymentMethodId={userPaymentMethodId}&deviceData={deviceData}&paymentType={CC || PayPal}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json;v=3' \
--header 'Authorization: Bearer 52268f6c-43df-44ad-8052-372ab7ae4dda'

Example response

{
"id": "9264499f-cb2f-4a1f-b720-61e2afabd45e",
"userId": 10014,
"extAgreementRef": "random",
"paymentInfo": "401200******0125",
"expireDate": "2021-12-01T00:00:00Z",
"registered": "2020-01-24T11:55:16Z",
"userPaymentMethodStatus": "ACTIVE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"captureAttemptLog": "Braintree response ok",
"paymentProviderId": 61,
"expirationDate": "2021-12-01T00:00:00Z"
}
curl --location --request GET 'http://{api-domain}/api/web/user/{userId}/userpaymentmethod' \
--header 'Authorization: Bearer {bearerToken}' \
--header 'Accept: application/json;v=3'

Example response

[
{
"id": "ad497506-d72c-447d-851f-daa09ce0e94a",
"userId": 10033,
"extAgreementRef": "random",
"paymentInfo": "2222 22** **** 2222",
"expireDate": "2020-12-20T00:00:00Z",
"registered": "2020-01-20T12:28:53Z",
"userPaymentMethodStatus": "ACTIVE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"captureAttemptLog": "Auth ok.",
"paymentProviderId": 41,
"expirationDate": "2020-12-20T00:00:00Z"
},
{
"id": "215aa1d7-b2ea-4474-9e86-40efe71ba0cf",
"userId": 10033,
"extAgreementRef": "random",
"paymentInfo": "1111 11** **** 1111",
"expireDate": "2020-12-20T00:00:00Z",
"registered": "2020-01-20T12:28:53Z",
"userPaymentMethodStatus": "ACTIVE",
"userPaymentMethodType": "CREDIT_CARD",
"allowOneClickBuy": true,
"captureAttemptLog": "Capture ok.",
"paymentProviderId": 41,
"expirationDate": "2020-12-20T00:00:00Z"
}
]

Get all payment transactions for a given userPaymentMethod

Section titled “Get all payment transactions for a given userPaymentMethod”
curl --location --request GET 'http://{api-domain}/api/web/user/{userId}/userpaymentmethod/{userPaymentMethodId}/transactions' \
--header 'Authorization: Bearer {bearerToken}' \
--header 'Accept: application/json;v=3'

Example response

[
{
"id": 9099,
"paymentProviderId": 41,
"price": 122.45,
"registered": "2020-01-20T12:45:33Z",
"status": "SUCCESS",
"transactionNumber": 0,
"type": "AUTORENEW",
"orderId": 8087,
"userPaymentMethodId": "38d6a628-2ab6-45a4-8c21-1cc9939d3e5b",
"vat": 0.0,
"startDate": "2020-01-19T12:43:45Z",
"endDate": "2020-02-03T12:43:45Z"
},
{
"id": 9098,
"paymentProviderId": 41,
"price": 46.79,
"registered": "2020-01-20T12:43:45Z",
"status": "SUCCESS",
"transactionNumber": 0,
"type": "PURCHASE",
"orderId": 8087,
"userPaymentMethodId": "38d6a628-2ab6-45a4-8c21-1cc9939d3e5b",
"vat": 0.0,
"startDate": "2020-01-20T12:43:45Z",
"endDate": "2020-01-30T12:43:45Z"
}
]
curl --location --request DELETE 'http://{api-domain}/api/web/user/{userId}/userpaymentmethod/{userPaymentMethodId}' \
--header 'Authorization: Bearer {bearerToken}'