Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions samples/init_multi_payment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Craftgate\Model\Currency;
use Craftgate\Model\PaymentGroup;
use Craftgate\Model\PaymentPhase;
use Craftgate\Util\Guid;

require_once('config/sample_config.php');

$request = array(
'price' => 100,
'paidPrice' => 100,
'callbackUrl' => 'callbackUrl',
'currency' => Currency::TL,
'conversationId' => '456d1297-908e-4bd6-a13b-4be31a6e47d5',
'externalId' => Guid::generate(),
'paymentGroup' => PaymentGroup::PRODUCT,
'paymentPhase' => PaymentPhase::AUTH,
'items' => array(
array(
'name' => 'Item 1',
'externalId' => '38983903',
'price' => 60,
),
array(
'name' => 'Item 2',
'externalId' => '92983294',
'price' => 40,
)
)
);

$response = SampleConfig::craftgate()->payment()->initMultiPayment($request);

print_r($response);
6 changes: 6 additions & 0 deletions src/Adapter/PaymentAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ public function retrieveActiveBanks()
return $this->httpGet($path);
}

public function initMultiPayment(array $request)
{
$path = "/payment/v1/multi-payments/init";
return $this->httpPost($path, $request);
}

public function retrieveMultiPayment($token)
{
$path = "/payment/v1/multi-payments/" . $token;
Expand Down