Ich versuche, eine Kreditkartenzahlung mit PayPal Rest API (Sandbox) auszuführen. Hier ist der Code:PayPal Rest-API Zahlung erstellen Rückgabe-ID nicht zurückgegeben
$payment = new Payment();
$payment->setIntent('sale');
...
try {
$payment->create($this->apiContext);
$saleId = $payment->getTransactions()[0]->getRelatedResources()[0]->getSale()->getId();
} catch (PayPalConnectionException $ex) {
...
}
Dieser sendet die folgende JSON:
{ "experience_profile_id": "XX-XXXX-XXXX-XXXX-XXXX", "Absicht": "Verkauf", "Zahler ": {" payer_info ": {" erster_name ":" Jim "," letzter_name ":" Smith "," email ":" [email protected] "," Telefon ":" "}," payment_method ":" credit_card "," funding_instruments ": [{" credit_card ": {" first_name ":" Jim "," last_name ":" Smith "," Nummer ":" XXXXXXXXXXXX4487 "," type ":" visa "," expire_month ":" 06 "," expire_year ":" 2020 "," cvv2 ":" 123 "," Abrechnungsadresse ": {" line1 ":" 123 Test Straße "," Linie2 ":" "," Stadt ":" Test Stadt "," state ":" "," postal_code ":" XXXX XXX "," country_code ":" GB "}}}]}," Transaktionen ": [{" Betrag ": {" Währung ":" GBP "," Summe ":" 13.50 "," Details ": {" Versand ":" 3.50 "," Steuer ":" 1.67 "," Zwischensumme ":" 8.33 "}}," Artikel_Liste ": {" Artikel ": [{" Name ":" T-Shirt Schwarz Klein ", "Währung": "GBP", "Menge": "1", "sku": "abc123", "Preis": "8.33"}], "shipping_address": {"recipient_name": "Jim Smith", " line1 ":" 123 Test Street "," line2 ":" "," city ":" Test Stadt "," state ":" Irgendein Staat "," postal_code ":" XXXX XXX "," country_code ":" GB "}}," description ":" Payment Details“, "INVOICE_NUMBER": "XXXXX"}]}
Dieser arbeitete bis vor kurzem in Ordnung, es ist aber jetzt noch nichts für die zugehörige Resour zurückkehren ces. hier ist die json ich zurück bin immer:
{ "id": "PAY-XXXXXXXXXXXXXXXXXXXXXX", "create_time": "2016-06-20T11: 45: 28Z", "update_time": "2016-06- 20T11: 45: 28Z "," state ":" erstellt "," Absicht ":" Verkauf "," Zahler ": {" payment_method ":" credit_card "," funding_instruments ": [{" credit_card ": {" type " : "visa", "number": "xxxxxxxxxxxx4487", "expire_month": "6", "expire_year": "2020", "first_name": "Jim", "Nachname": "Smith", "billing_address": { "line1": "123 Teststraße", "Stadt": "Teststadt", "postal_code": "XXXX XXX", "country_code": "GB"}}}}}, "Transaktionen": [{" Betrag ": {" total ":" 13.50 "," Währung ":" GBP "," Details ": {" Zwischensumme ":" 8.33 "," Steuer ":" 1.67 "," Versand ":" 3.50 "}} , "description": "Zahlung Details", "Artikel_Liste": {"Artikel": [{"name": "T-Shirt Schwarz Sm all "," sku ":" abc123 "," Preis ":" 8.33 "," Währung ":" GBP "," Menge ":" 1 "}]," shipping_address ": {" recipient_name ":" Jim Smith "," line1 ":" 123 Test Street "," Stadt ":" Test City "," state ":" Einige State "," postal_code ":" XXXX XXX "," country_code ":" GB "}} "related_resources": []}], "Links": [{ "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-XXXXXXXXXXXXXXXXXXXXXX", "rel": "selbst", "Methode": "GET"}]}
Bitte beachten Ich benutze Version 1.7.2 der API und ich habe vor kurzem auf PHP Version 7 aktualisiert.
Ich würde es schätzen, wenn jemand erklären könnte, was ich falsch mache.
Dank
Sie müssen auch die Fehlerprotokolle erstellen und die Setups Ihrer Integration angeben, z. Endpunkt auf Sandbox oder Live festgelegt? was ist in der Antwort Ihrer PAY api Anruf .. –
@pp_pduan Ich habe die Frage aktualisiert, die angibt, dass ich die Sandbox und die JSON-Antwort verwende, die ich zurückbekomme. Wie Sie sehen können, ist die related_resources leer. Ich hoffe das hilft. – nfplee
Version 1.7.2 ??? Gibt es eine solche Versionsnummer ?, die aktuelle Version ist 204 – SML