-
Notifications
You must be signed in to change notification settings - Fork 6
Hosted payment page
Roger Cruz edited this page Dec 27, 2017
·
3 revisions
You may also choose to redirect the user to our hosted payment page:
To do that use the hosted
gateway:
$request = new Request([
// Customer
'person' => new Person([
// Customer's email
'email' => 'john.doe@someserver.tld',
// Customer's name (optional)
'name' => 'Customer',
]),
// Customer's Billing Address
'address' => new Address([
// Customer's Country
'country' => Country::ARGENTINA,
// Street name (optional)
'address' => 'Av. Díaz Vélez',
// Street number (optional)
'streetNumber' => '225B',
// Street complement (optional)
'streetComplement' => 'Bloco B Ap 2',
// Zip code (optional)
'zipCode' => '7630',
// State (optional)
'state' => 'Provincia de Buenos Aires',
// City (optional)
'city' => 'Buenos Aires'
]),
// Amount in your website's currency (the one set in $config)
'amount' => 25.00,
// Your own transaction control code for this payment (must be unique)
'merchantPaymentCode' => $controlCode,
// Your own order control code (optional)
'orderNumber' => $orderId,
// Payment type code based on EBANX's API used for restricting payment methods
// (optional, don't change unless you know what you are doing)
'type' => 'potatoes',
// Number of maximum credit card instalments allowed if customer chooses credit card (optional)
'maxInstalments' => 36,
// Number of minimum credit card instalments allowed if customer chooses credit card (optional)
'minInstalments' => 1,
// Your custom values to be passed in every http request, up to 4 strings
'userValues' => [],
// Your Sub Account settings for used for localisation in our hosted checkout page
// (optional) and can only be used when enabled by your EBANX account manager
'subAccount' => new SubAccount([
// Sub Account name
'name' => 'Loja Ejemplo',
'imageUrl' => 'https://samplestore.com/assets/ar_logo.png'
])
]);
EBANX($config)->hosted()->create($request);
This will give you the following raw response:
Array
(
[payment] => Array
(
[hash] => <paymenthashgoeshere>
[pin] => 000000000
[merchant_payment_code] => PAYMENT_ONE
[order_number] => 1001
[status] => OP
[status_date] =>
[open_date] => 2018-01-01 00:00:00
[confirm_date] =>
[transfer_date] =>
[amount_br] => 10.04
[amount_ext] => 10
[amount_iof] => 0.04
[amount_usd] => 2.89
[currency_rate_usd] => 3.4555
[currency_rate] => 1
[currency_ext] => BRL
[due_date] => 2018-01-03
[instalments] => 1-12
[payment_type_code] => _all
[pre_approved] =>
[capture_available] =>
[customer] =>
)
[redirect_url] => https://checkout.ebanx.com/checkout?hash=<paymenthashgoeshere>
[status] => SUCCESS
)
Using the redirect_url
key you can send your customers to our closed checkout environment.