-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Billing Address na criacao de OrderCreditCard #25
Comments
Olá, tive alguns problemas similares, já experimentou criar o objeto billing_adddress ? $payments->creditCard->card->billingAddress = new CreateAddressRequest( ); E depois passa os valores onde deixei as aspas "" $payments->creditCard->card->billingAddress->street = ""; Na requisição vai ficar assim, claro que com os seus dados preenchidos "billing_address": { Um abraço e até mais. |
Fala @juniormaciel beleza ?, infelizmente parece que não deu certo, vou te mostrar meu código obs: coloquei dados fake aqui no post, porém quando viro a chave para producao, aparece esse erro, no ambiente de teste funciona. $client = new \PagarmeCoreApiLib\PagarmeCoreApiClient($basicAuthUserName, $basicAuthPassword);
$customerController = $client->getCustomers();
$customer = new \PagarmeCoreApiLib\Models\CreateCustomerRequest();
$customer->name = $holder_name;
$customer->email = "jhony@gmail.com";
$customer->document_type = "CPF";
$customer->document = "33333333333";
$customer->type = "individual";
$customer->code = "777";
$customer->address = new \PagarmeCoreApiLib\Models\CreateAddressRequest();
$customer->address->street = "375, Av. General Justo, Centro";
$customer->address->line1 = "375, Av. General Justo, Centro";
$customer->address->zipCode = "04678002";
$customer->address->neighborhood = "Gopouva";
$customer->address->number = "77";
$customer->address->city = "Sao Paulo";
$customer->address->state = "SP";
$customer->address->country = "BR";
$customer->address->metadata = new \PagarmeCoreApiLib\Models\UpdateMetadataRequest();
$customer->address->metadata->id = "1234";
$customer->phones = new \PagarmeCoreApiLib\Models\CreatePhonesRequest();
$customer->phones->homePhone = new \PagarmeCoreApiLib\Models\CreatePhoneRequest();
$customer->phones->homePhone->areaCode = "11";
$customer->phones->homePhone->countryCode = "55";
$customer->phones->homePhone->number = "58587070";
$request = new \PagarmeCoreApiLib\Models\CreateCardRequest();
$request->number = str_replace('.','', $cc_number);
$request->holderName = $holder_name;
$request->expMonth = (int)$due_date[0];
$request->expYear = (int)$due_date[1];
$request->cvv = $cvv;
$request->holderDocument = "33333333333";
// Billing Address;
$request->billingAddress = new \PagarmeCoreApiLib\Models\CreateAddressRequest();
$request->billingAddress->line1 = "Rua dona Antonia";
$request->billingAddress->street = "Rua dona Antonia";
$request->billingAddress->zipCode = "7021000";
$request->billingAddress->city = "Guarulhos";
$request->billingAddress->neighborhood = "Gopouva";
$request->billingAddress->state = "SP";
$request->billingAddress->country = "BR";
$createdCustomer = $customerController->createCustomer($customer);
$result = $customerController->createCard($createdCustomer->id, $request);
$orderController = $client->getOrders();
$creditCard = new \PagarmeCoreApiLib\Models\CreateCreditCardPaymentRequest();
$creditCard->capture = true;
$creditCard->installments = 1;
$creditCard->card = new \PagarmeCoreApiLib\Models\CreateCardRequest();
$creditCard->card->number = str_replace('.','', $cc_number);
$creditCard->card->holderName = $holder_name;
$creditCard->card->expMonth = (int)$due_date[0];
$creditCard->card->expYear = (int)$due_date[1];
$creditCard->card->cvv = $cvv;
$request = new \PagarmeCoreApiLib\Models\CreateOrderRequest();
$request->items = [new \PagarmeCoreApiLib\Models\CreateOrderItemRequest()];
$request->items[0]->description = "Encontro com Deus";
$request->items[0]->quantity = 1;
$request->items[0]->amount = 100 * 1; // this value should be in cents
$request->items[0]->code = "777"; // this value should be in cents
$request->payments = [new \PagarmeCoreApiLib\Models\CreatePaymentRequest()];
$request->payments[0]->paymentMethod = "credit_card";
$request->payments[0]->creditCard = $creditCard;
$request->customer = $customer;
$result = $orderController->createOrder($request);
echo json_encode($result, JSON_PRETTY_PRINT); |
Fala @jhonyjss , tranquilo Comparando aqui parece tudo normal, se em teste funciona em produção deveria funcionar também, mais vai saber né... Comparando com a minha saída aqui, verifiquei apenas alguns detalhes diferentes: O bloco Billing Address deve estar dentro do objeto $creditCard->card->billingAddress
Experimenta aí e me fala, um abraço. |
@juniormaciel eu abri uma outra issue isso e o mais critico. |
Ola tudo bem ?
Estou enfrentando dificuldades para criar pagamentos e esta constando como status FALHA por que nao consigo enviar o billing_address.
poderiam me ajudar a tirar essa duvida ?
obrigado
The text was updated successfully, but these errors were encountered: