-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
40 lines (33 loc) · 1.17 KB
/
example.php
File metadata and controls
40 lines (33 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
use Basement\AbacatePay\AbacatePayClient;
use Basement\AbacatePay\Billing\Http\Request\CreateBillingRequest;
use Basement\AbacatePay\Billing\Http\Request\ProductRequest;
use Basement\AbacatePay\Customer\Http\Request\CreateCustomerRequest;
require __DIR__.'/vendor/autoload.php';
$client = new AbacatePayClient('token');
$customer = $client->customer()->create(
CreateCustomerRequest::builder()
->email('fulano@email.com')
->cellphone('(11) 4002-8922')
->name('fulano')
->taxId('209.206.850-48')
->build());
$response = $client->billing()
->create(
CreateBillingRequest::oneTime()
->pix()
->completionUrl('https://google.com')
->returnUrl('https://google.com')
->forCustomerId($customer->data->id)
->externalId((string) time())
->addProduct(ProductRequest::builder()
->name('some-amazing-product')
->description('fodase')
->quantity(1)
->externalId((string) time())
->price(1050)
->build())
->build()
);
var_dump($response);