1
+ <?php
2
+ use Tatrapayplus \TatrapayplusApiClient \Api \TatraPayPlusAPIApi ;
3
+
4
+ $ tatrapayplus_api = new TatraPayPlusAPIApi (
5
+ "your-client-id " ,
6
+ "your-client-secret " ,
7
+ );
8
+
9
+ $ address = new Tatrapayplus \TatrapayplusApiClient \Model \Address ([
10
+ "street_name " => "TestStreet " ,
11
+ "building_number " => "12 " ,
12
+ "town_name " => "Town " ,
13
+ "post_code " => "97405 " ,
14
+ "country " => "SK " ,
15
+ ]);
16
+ $ initiate_payment_request = new Tatrapayplus \TatrapayplusApiClient \Model \InitiatePaymentRequest ([
17
+ "base_payment " => new Tatrapayplus \TatrapayplusApiClient \Model \BasePayment ([
18
+ "instructed_amount " => new Tatrapayplus \TatrapayplusApiClient \Model \Amount ([
19
+ "amount_value " => 10.0 ,
20
+ "currency " => "EUR " ,
21
+ ]),
22
+ "end_to_end " => new Tatrapayplus \TatrapayplusApiClient \Model \E2e ([
23
+ "variable_symbol " => "ORDER123456 " ,
24
+ ]),
25
+ ]),
26
+ "bank_transfer " => new Tatrapayplus \TatrapayplusApiClient \Model \BankTransfer (),
27
+ "user_data " => new Tatrapayplus \TatrapayplusApiClient \Model \UserData ([
28
+ "first_name " => "Janko " ,
29
+ "last_name " => "Hrasko " ,
30
+ "email " => "janko.hrasko@example.com " ,
31
+ ]),
32
+ "card_detail " => new Tatrapayplus \TatrapayplusApiClient \Model \CardDetail ([
33
+ "card_holder " => "Janko Hrasko " ,
34
+ "billing_address " => $ address ,
35
+ "shipping_address " => $ address ,
36
+ ]),
37
+ "pay_later " => new Tatrapayplus \TatrapayplusApiClient \Model \PayLater ([
38
+ "order " => new Tatrapayplus \TatrapayplusApiClient \Model \Order ([
39
+ "order_no " => "ORDER123456 " ,
40
+ "order_items " => [
41
+ new Tatrapayplus \TatrapayplusApiClient \Model \OrderItem ([
42
+ "quantity " => 1.0 ,
43
+ "total_item_price " => 10.0 ,
44
+ "item_detail " => new Tatrapayplus \TatrapayplusApiClient \Model \ItemDetail ([
45
+ "item_detail_en " => new Tatrapayplus \TatrapayplusApiClient \Model \ItemDetailLangUnit ([
46
+ "item_name " => "Product 1 " ,
47
+ ]),
48
+ "item_detail_sk " => new Tatrapayplus \TatrapayplusApiClient \Model \ItemDetailLangUnit ([
49
+ "item_name " => "Produkt 1 " ,
50
+ ]),
51
+ ]),
52
+ ]),
53
+ ],
54
+ ]),
55
+ ]),
56
+ ]);
57
+
58
+ $ response = $ tatrapayplus_api ->initiatePayment (
59
+ "redirect uri " ,
60
+ $ initiate_payment_request ,
61
+ );
62
+ $ response ["object " ]->getPaymentId (); // newly created payment ID
0 commit comments