This site requires javascript to be enabled.

  • Search AI-powered

Results for

xxx

Create a token from payment

POST https://{domainname}/v1/{merchantId}/payments/{paymentId}/tokenize

Payments

The payments REST services allow you to initiate a payment, retrieve the payment details or perform specific actions like refunding or requesting capture of a payment. A payment is identified by its paymentId. Some payment products allow a two step approach allowing you to control when the authorization takes place separate from when the funds are actually captured.

Request

Use this call if you want to convert the payment details into a re-usable token. This call is especially useful if you don't have access to sensitive data like card data, but you have processed transaction successfully based on card data that has been collected either using our MyCheckout hosted payment pages or through one of the Client SDKs that encrypted this data.

PayloadTokenizePaymentRequest

Properties
Property Type Required Details
close

Description

An alias for the token. This can be used to visually represent the token.
If no alias is given, a payment product specific default is used, e.g. the obfuscated card number for card payment products.
Do not include any unobfuscated sensitive data in the alias.

Request example

SDK: Java

This scenario you will probably use the most

  • TokenizePaymentRequest body = new TokenizePaymentRequest();
    body.setAlias("Some alias");
    
    CreateTokenResponse response = client.v1().merchant("merchantId").payments().tokenize("paymentId", body);
    

Responses

Please find below an overview of the possible responses.

Response 200 - OKCreateTokenResponse

A new token has not been created as one already existed. You will get this response if you tried to create a token for a card that has already been tokenized for this merchantId. You should verify if you would like to update the data that is stored in the existing token as no data is updated when a duplicate token is detected. The only way to update the data stored in a token you will need to use the update token call.

Properties
Property Type Required Details
close

Description

Indicates if a new token was created
  • true - A new token was created
  • false - A token with the same card number already exists and is returned. Please note that the existing token has not been updated. When you want to update other data then the card number, you need to use the update API call, as data is never updated during the creation of a token.
close

Description

The initial Payment ID of the transaction from which the token has been created
close

Description

ID of the token

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "isNewToken" : false,
        "token" : "bfa8a7e4-4530-455a-858d-204ba2afb77e"
    }
    

Response 201 - CreatedCreateTokenResponse

A new token has been created based on the payment data stored in the payment object.

Properties
Property Type Required Details
close

Description

Indicates if a new token was created
  • true - A new token was created
  • false - A token with the same card number already exists and is returned. Please note that the existing token has not been updated. When you want to update other data then the card number, you need to use the update API call, as data is never updated during the creation of a token.
close

Description

The initial Payment ID of the transaction from which the token has been created
close

Description

ID of the token

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "isNewToken" : true,
        "token" : "bfa8a7e4-4530-455a-858d-204ba2afb77e"
    }
    

Response 400 - Bad requestErrorResponse

Properties
Property Type Required Details
close

Description

Unique reference, for debugging purposes, of this error response
close

Description

List of one or more errors
close

Description

Contains detailed information on one single error.
  • SDK Object type
    APIError
close

Description

Category the error belongs to. The category should give an indication of the type of error you are dealing with. Possible values:
  • CONNECT_PLATFORM_ERROR - indicating that a functional error has occurred in the Connect platform.
  • PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the Payment platform.
  • IO_ERROR - indicating that a technical error has occurred within the Connect platform or between Connect and any of the payment platforms or third party systems.
close

Description

Error code
close

Description

HTTP status code for this error that can be used to determine the type of error
close

Description

ID of the error. This is a short human-readable message that briefly describes the error.
close

Description

Human-readable error message that is not meant to be relayed to customer as it might tip off people who are trying to commit fraud
close

Description

Returned only if the error relates to a value that was missing or incorrect.
Contains a location path to the value as a JSonata query.
Some common examples:
  • a.b selects the value of property b of root property a,
  • a[1] selects the first element of the array in root property a,
  • a[b='some value'] selects all elements of the array in root property a that have a property b with value 'some value'.
close

Description

ID of the request that can be used for debugging purposes

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "errorId" : "15eabcd5-30b3-479b-ae03-67bb351c07e6-00000092",
        "errors" : [
            {
                "code" : "20000000",
                "propertyName" : "bankAccountBban.accountNumber",
                "message" : "PARAMETER_NOT_FOUND_IN_REQUEST"
            }
        ]
    }
    

Response 404 - Not foundErrorResponse

The payment you are trying to convert into a token could not be found.

Properties
Property Type Required Details
close

Description

Unique reference, for debugging purposes, of this error response
close

Description

List of one or more errors
close

Description

Contains detailed information on one single error.
  • SDK Object type
    APIError
close

Description

Category the error belongs to. The category should give an indication of the type of error you are dealing with. Possible values:
  • CONNECT_PLATFORM_ERROR - indicating that a functional error has occurred in the Connect platform.
  • PAYMENT_PLATFORM_ERROR - indicating that a functional error has occurred in the Payment platform.
  • IO_ERROR - indicating that a technical error has occurred within the Connect platform or between Connect and any of the payment platforms or third party systems.
close

Description

Error code
close

Description

HTTP status code for this error that can be used to determine the type of error
close

Description

ID of the error. This is a short human-readable message that briefly describes the error.
close

Description

Human-readable error message that is not meant to be relayed to customer as it might tip off people who are trying to commit fraud
close

Description

Returned only if the error relates to a value that was missing or incorrect.
Contains a location path to the value as a JSonata query.
Some common examples:
  • a.b selects the value of property b of root property a,
  • a[1] selects the first element of the array in root property a,
  • a[b='some value'] selects all elements of the array in root property a that have a property b with value 'some value'.
close

Description

ID of the request that can be used for debugging purposes

Response example

SDK: Java

This scenario you will probably use the most

  • {
        "errorId" : "657b10da-d2f9-4088-a948-bf190ef516b1-00000261",
        "errors" : [
            {
                "code" : "400300",
                "message" : "PAYMENTATTEMPT_NOT_FOUND"
            }
        ]
    }