iugu php
1.0.0
이 LIB는 모든 API 버전의 모든 기능을 사용할 수 있도록 유연하게 만들기 위해 제작되었습니다.
이 링크에 액세스하여 IUGU의 공식 문서에 액세스 할 수 있습니다.
명령을 사용하여 라이브러리를 설치하십시오
composer require igorsamaral/iugu-php
프로젝트에 라이브러리를 포함하려면 다음을 수행하십시오.
<?php
require __DIR__ . " /vendor/autoload.php "
$ iugu = new IuguClient( " SUA_CHAVE_DE_API ");Client 객체의 인스턴스화 중에 간단히 알립니다. <?php
require __DIR__ . " /vendor/autoload.php "
$ iugu = new iuguClient(
" SUA_CHAVE_DE_API ",
[ " headers " => [ " MEU_HEADER_CUSTOMIZADO " => " VALOR HEADER CUSTOMIZADO " ]]
); 그런 다음 고객을 사용하여 아래 예제에서와 같이 Yugu.com.br에 요청할 수 있습니다.
고객은 상점 또는 비즈니스 사용자를 나타냅니다. 이 개체에는 이름, 이메일 및 전화 및 기타 필드와 같은 정보가 포함되어 있습니다.
<?php
$ customer = $ iugu -> customers ()-> create ([
" email " => " [email protected] " ,
" name " => " João das Neves " ,
" notes " => " lorem... " ,
" phone " => " 999999999 " ,
" phone_prefix " => " 11 " ,
" cpf_cnpj " => " 11743685009 " ,
" zip_code " => " 76814112 " ,
" number " => " 100 " ,
" street " => " Rua Cabedelo " ,
" city " => " Porto Velho " ,
" state " => " RO " ,
" district " => " Marcos Freire " ,
" complement " => " complemento... " ,
" custom_variables " => [
" key " => " value "
]
]); <?php
$ customers = $ iugu -> customers ()-> getList (); <?php
$ customer = $ iugu -> customers ()-> get ([
" id " => " ID_DO_CLIENTE "
]);Token은 고객 지불 진술 (예 : 신용 카드)으로 완전히 안전 하므로이 토큰을 사용하여 고객 신용 카드 정보를 얻을 수 없습니다. 토큰은 특정 거래를 위해 생성되어 더 안전합니다.
<?php
$ token = $ iugu -> paymentToken ()-> create ([
" account_id " => " ID_DA_SUA_CONTA_IUGU " ,
" customer_id " => " ID_DO_CUSTOMER " ,
" method " => " credit_card " ,
" data " => [
" number " => " 4242424242424242 " ,
" verification_value " => " 648 " ,
" first_name " => " João " ,
" last_name " => " das Neves " ,
" month " => " 01 " ,
" year " => " 2023 "
],
" test " => true ,
]);티켓 또는 신용 카드를 통한 간단한 요금.
<?php
$ charge = $ iugu -> charges ()-> create ([
" token " => " ID_DO_TOKEN_DE_PAGAMENTO_CRIADO " ,
" customer_id " => " ID_DO_CUSTOMER " ,
" total " => 10000 ,
" payer " => [
" cpf_cnpj " => " 84752882000 " ,
" name " => " João das Neves " ,
" address " => [
" zip_code " => " 72917210 " ,
" number " => " 100 "
]
],
" items " : [
[
" description " => " Descrição do item 1 " ,
" quantity " => 1 ,
" price_cents " => 10000
]
]
]);고객을위한 송장을 만듭니다.
<?php
$ invoice = $ iugu -> invoices ()-> create ([
" email " => " [email protected] " ,
" due_date " => " 2021-07-21 " ,
" items " => [
[
" description " => " Descrição do item 1 " ,
" quantity " => 1 ,
" price_cents " => 10000
]
],
" total " => 10000 ,
" payer " => [
" cpf_cnpj " => " 84752882000 " ,
" name " => " João das Neves " ,
" address " => [
" zip_code " => " 72917210 " ,
" number " => " 100 "
]
]
]); <?php
$ invoices = $ iugu -> invoices ()-> getList (); <?php
$ invoice = $ iugu -> invoices ()-> get ([
" id " => " ID_DA_FATURA "
]);