# Card2Card (p2p)

Currently, it is possible to make transfers from card to card (card2card) using the payer’s linked card without his direct participation.

For these purposes, it is necessary to first carry out tokenization of card data for the debit card

In this case, both the card token obtained as a result of one of the tokenization options and the full card number can be used as the recipient’s card.

Within this API call, an object is added to the standard callsource, where as the valuecardtransmittedidpreviously completed successful tokenization of full card data or [card number](./api_tokenization.md#tokenization-card number) and objectdestination, where as the valueknownCardNumberthe card number is sent or as an objectcardtransmittedidpreviously successful tokenization of full card data or [card number](./api_tokenization.md#tokenization-card number), as well as the value"interactive": false, responsible for ensuring that the operation takes place without 3d-secure.

IMPORTANT! In case of transfer"interactive": truethe request will fail with an error

The transaction is carried out asynchronously. As a result of the request, you will synchronously receive idpayments, and then callback-notification will arrive asynchronously.

Parameter Required Parameter Required
payment Yes destination Yes
payment.action Yes destination.card/knownCardNumber Yes
payment.orderId Yes interactive Yes
payment.price Yes
source Yes
source.card Yes

Synchronous response and asynchronous callback-notification can contain a wider set of parameters compared to the example.

Request from destination.card

POST https://secure.mandarinpay.com/api/transactions
{
	"payment": {
		"action": "card2card",
		"orderId": "your_unique_order_id",
		"price": "1000.00"
	},
   "interactive": false,
   "source": {
        "card": "63eed817-c56e-4aac-ad38-15113ed13744"
   },
   "destination": {
        "card": "89dfbcf9-5228-46e2-816d-c93e65bee1ac"
   },
	"customerInfo": {
		"email": "user@example.com",
		"phone": "+79001234567"
	},
	"urls": {
		"callback": "http://...",
		"return": "http://..."
	}
}

Request with destination.knownCardNumber

POST https://secure.mandarinpay.com/api/transactions
{
	"payment": {
		"action": "card2card",
		"orderId": "your_unique_order_id",
		"price": "1000.00"
	},
   "interactive": false,
   "source": {
        "card": "63eed817-c56e-4aac-ad38-15113ed13744"
   },
   "destination": {
        "knownCardNumber": "2202202244861047"
   },
	"customerInfo": {
		"email": "user@example.com",
		"phone": "+79001234567"
	},
	"urls": {
		"callback": "http://...",
		"return": "http://..."
	}
}

Response in case of successful transaction creation (200 OK)

{
	"id": "43913ddc000c4d3990fddbd3980c1725"
}

Answer if the transaction is not created (400 Bad request)

{
	"error": "Invalid request"  
}

Response in case of an attempt to create a payment with an existing valueorderId(400 Bad Request)

{
    "error": "Duplicate order id 5f2fdcf6-0b78-4dd7-be9f-212c7c058001 found for incomplete payout transaction",
    "errorCode": -2
}