Skip to main content
The ApiPayIns class provides methods to create and manage pay-in transactions, which represent funds being paid into a wallet.

Methods

Create

Create a new pay-in object.
public function Create($payIn, $idempotencyKey = null)
payIn
\MangoPay\PayIn
required
The PayIn object to create. Must have PaymentDetails and ExecutionDetails set.
idempotencyKey
string
Optional idempotency key for safe retries
Returns: \MangoPay\PayIn - The created PayIn object Example:
$payIn = new \MangoPay\PayIn();
$payIn->AuthorId = $userId;
$payIn->CreditedWalletId = $walletId;
$payIn->DebitedFunds = new \MangoPay\Money();
$payIn->DebitedFunds->Currency = 'EUR';
$payIn->DebitedFunds->Amount = 1000;
$payIn->Fees = new \MangoPay\Money();
$payIn->Fees->Currency = 'EUR';
$payIn->Fees->Amount = 10;

// Set payment and execution details based on payment method
$payIn->PaymentType = 'CARD';
$payIn->ExecutionType = 'DIRECT';

$result = $api->PayIns->Create($payIn);

Get

Get a pay-in object by ID.
public function Get($payInId)
payInId
string
required
The unique identifier of the pay-in
Returns: \MangoPay\PayIn - The PayIn object Example:
$payIn = $api->PayIns->Get('payin_123456');

CreateRefund

Create a refund for a pay-in transaction.
public function CreateRefund($payInId, $refund, $idempotencyKey = null)
payInId
string
required
The ID of the pay-in to refund
refund
\MangoPay\Refund
required
The Refund object to create
idempotencyKey
string
Optional idempotency key for safe retries
Returns: \MangoPay\Refund - The created Refund object Example:
$refund = new \MangoPay\Refund();
$refund->AuthorId = $userId;
$refund->DebitedFunds = new \MangoPay\Money();
$refund->DebitedFunds->Currency = 'EUR';
$refund->DebitedFunds->Amount = 500;
$refund->Fees = new \MangoPay\Money();
$refund->Fees->Currency = 'EUR';
$refund->Fees->Amount = 5;

$result = $api->PayIns->CreateRefund('payin_123456', $refund);

GetRefunds

Retrieve a list of refunds for a pay-in.
public function GetRefunds($payInId, & $pagination = null, $filter = null, $sorting = null)
payInId
string
required
The ID of the pay-in
pagination
\MangoPay\Pagination
Pagination object (passed by reference)
filter
\MangoPay\FilterRefunds
Filtering options
sorting
\MangoPay\Sorting
Sorting options
Returns: \MangoPay\Refund[] - Array of Refund objects Example:
$pagination = new \MangoPay\Pagination();
$refunds = $api->PayIns->GetRefunds('payin_123456', $pagination);

GetExtendedCardView

Retrieve detailed card information for a web payment.
public function GetExtendedCardView($payInId)
payInId
string
required
The ID of the pay-in
Returns: \MangoPay\PayInWebExtendedView - Extended card details Example:
$cardDetails = $api->PayIns->GetExtendedCardView('payin_123456');

CreatePayPal

Create a PayPal web pay-in.
public function CreatePayPal($payIn, $idempotencyKey = null)
payIn
\MangoPay\PayIn
required
PayIn object configured for PayPal
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PayIn Example:
$payIn = new \MangoPay\PayIn();
$payIn->PaymentType = 'PAYPAL';
// Configure PayPal-specific details...
$result = $api->PayIns->CreatePayPal($payIn);

CreateGooglePay

Create a Google Pay direct pay-in.
public function CreateGooglePay($payIn, $idempotencyKey = null)
payIn
\MangoPay\PayIn
required
PayIn object configured for Google Pay
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PayIn Example:
$payIn = new \MangoPay\PayIn();
$payIn->PaymentType = 'GOOGLEPAY';
// Configure Google Pay-specific details...
$result = $api->PayIns->CreateGooglePay($payIn);

CreateRecurringRegistration

Create a recurring payment registration.
public function CreateRecurringRegistration($recurringRegistration, $idempotencyKey = null)
recurringRegistration
\MangoPay\PayInRecurringRegistration
required
The recurring registration object
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PayInRecurringRegistrationRequestResponse

GetRecurringRegistration

Get a recurring payment registration.
public function GetRecurringRegistration($recurringRegistrationId, $idempotencyKey = null)
recurringRegistrationId
string
required
The ID of the recurring registration
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PayInRecurringRegistrationGet

UpdateRecurringRegistration

Update a recurring payment registration.
public function UpdateRecurringRegistration($recurringUpdate, $idempotencyKey = null)
recurringUpdate
PayInRecurringRegistrationUpdate
required
The update object with registration ID
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PayInRecurringRegistrationGet

GetPaymentMethodMetadata

Look up metadata from BIN or Google Pay token.
public function GetPaymentMethodMetadata(PaymentMethodMetadata $paymentMethodMetadata, $idempotencyKey = null)
paymentMethodMetadata
\MangoPay\PaymentMethodMetadata
required
Payment method metadata object
idempotencyKey
string
Optional idempotency key
Returns: \MangoPay\PaymentMethodMetadata

PayIn Entity

The PayIn entity represents a pay-in transaction.

Properties

Id
string
The unique identifier of the pay-in
CreationDate
int
Unix timestamp of when the pay-in was created
Tag
string
Custom data for your use
AuthorId
string
required
The user ID of the author
CreditedUserId
string
The user ID whose wallet is credited
CreditedWalletId
string
required
The ID of the wallet to credit
DebitedFunds
\MangoPay\Money
required
The amount debited from the payment source
CreditedFunds
\MangoPay\Money
The amount credited to the wallet (DebitedFunds - Fees)
Fees
\MangoPay\Money
required
The fees taken from the transaction
Status
string
The status of the transaction: CREATED, SUCCEEDED, FAILED
ResultCode
string
The result code of the transaction
ResultMessage
string
The result message explaining the result code
ExecutionDate
int
Unix timestamp of when the transaction was executed
Type
string
The transaction type: PAYIN
Nature
string
The transaction nature: REGULAR, REFUND, REPUDIATION
PaymentType
string
required
The payment type: CARD, BANK_WIRE, DIRECT_DEBIT, PAYPAL, PAYCONIQ, GOOGLEPAY, etc.
PaymentDetails
object
required
Payment-specific details object (type depends on PaymentType)
ExecutionType
string
required
How the pay-in is executed: WEB, TOKEN, DIRECT, PREAUTHORIZED, RECURRING_ORDER_EXECUTION
ExecutionDetails
object
required
Execution-specific details object (type depends on ExecutionType)
RecurringPayinRegistrationId
string
The ID of the recurring payment registration
PaymentCategory
string
The payment category: ECommerce (default), TelephoneOrder
ProfilingAttemptReference
string
Reference for fraud prevention profiling session
AuthenticationResult
\MangoPay\AuthenticationResult
3DS authentication result for card transactions

Build docs developers (and LLMs) love