• Namespace
  • Class

Namespaces

  • Klarna
    • Exceptions
    • Rest
      • Checkout
      • CustomerToken
      • HostedPaymentPage
      • InstantShopping
      • MerchantCardService
      • OrderManagement
      • Payments
      • Settlements
      • Transport
        • Exception

Classes

  • Tokens

Class Tokens

Tokens resource.

The Customer Token API is used to charge customers with a tokenized Klarna payment method and can be used for recurring purchases, subscriptions and for storing a customer's payment method. Tokens are created using the generate a customer token call in the payments API.

ArrayObject implements IteratorAggregate, Traversable, ArrayAccess, Serializable, Countable
Extended by Klarna\Rest\Resource
Extended by Klarna\Rest\CustomerToken\Tokens
Namespace: Klarna\Rest\CustomerToken
Example: docs/examples/CustomerTokenAPI/Tokens/create_order.php Create a new order using customer token
Example: docs/examples/CustomerTokenAPI/Tokens/read_token_details.php Read customer token details
Located at Klarna/Rest/CustomerToken/Tokens.php

Methods summary

public
# __construct( Klarna\Rest\Transport\ConnectorInterface $connector, string $customerToken )

Constructs a Tokens instance.

Constructs a Tokens instance.

Parameters

$connector
HTTP transport connector
$customerToken
Customer Token

Overrides

Klarna\Rest\Resource::__construct
public array
# createOrder( array $data, string $klarnaIdempotencyKey = null )

Creates order using Customer Token.

Creates order using Customer Token.

Parameters

$data
Order data
$klarnaIdempotencyKey
Idempotency Key

Returns

array
created order data

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
RuntimeException
If the location header is missing
RuntimeException
If the API replies with an unexpected response
LogicException
When Guzzle cannot populate the response
public Klarna\Rest\CustomerToken\Tokens
# updateTokenStatus( array $data )

Update the status of a customer token.

Update the status of a customer token.

Parameters

$data
Customer token data

Returns

Klarna\Rest\CustomerToken\Tokens

Throws

Klarna\Rest\Transport\Exception\ConnectorException
When the API replies with an error response
GuzzleHttp\Exception\RequestException
When an error is encountered
RuntimeException
If the API replies with an unexpected response
LogicException
When Guzzle cannot populate the response

Methods inherited from Klarna\Rest\Resource

delete(), exchangeArray(), fetch(), get(), getId(), getLocation(), patch(), post(), put(), request(), setId(), setLocation()

Methods inherited from ArrayObject

append(), asort(), count(), getArrayCopy(), getFlags(), getIterator(), getIteratorClass(), ksort(), natcasesort(), natsort(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), serialize(), setFlags(), setIteratorClass(), uasort(), uksort(), unserialize()

Magic methods summary

Constants summary

Constants inherited from Klarna\Rest\Resource

ID_FIELD

Constants inherited from ArrayObject

ARRAY_AS_PROPS, STD_PROP_LIST

Properties summary

public static string $path

Path to the resource endpoint.

Path to the resource endpoint.

# '/customer-token/v1/tokens'

Properties inherited from Klarna\Rest\Resource

$connector, $url

API documentation generated by ApiGen