rejoice Posted March 4, 2019 Report Share Posted March 4, 2019 How can I fetch the PayPal CC endpoints using REST? What is the model or plugin I need to use? Quote Link to comment Share on other sites More sharing options...
coreyman Posted March 4, 2019 Report Share Posted March 4, 2019 This is just a guess, but if you look in \projectfolder\vendors\components\gateways\nonmerchant\paypal_payments_standard\paypal_payments_standard.php you will find PaypalPaymentsStandard extends NonmerchantGateway It looks like you are required to have a Blesta invoice to pay to use this gateway, so you will probably need to generate an invoice first. On line 232 there is buildProcess where I found this information. It looks like it's building the request to paypal. Maybe someone else can shed some more light. rejoice 1 Quote Link to comment Share on other sites More sharing options...
coreyman Posted March 5, 2019 Report Share Posted March 5, 2019 I found this - So I tried accessing an endpoint via the attached image method in postman and it looks like we are on the right track. Looks like the arguments are as follows - "contact_info" => $contact_info, "amount" => $amount, "currency" => $currency, "invoice_amounts" => $invoice_amounts, "options" => $options, "gateway_id" => $gateway_id This method and docblock can be found in \components\gateway_payments\gateway_payments.php /** * Returns an array of HTML markup used to render capture and pay requests for non-merchant gateways * * @param array $contact_info An array of contact info including: * - id The contact ID * - client_id The ID of the client this contact belongs to * - user_id The user ID this contact belongs to (if any) * - contact_type The type of contact * - contact_type_id The ID of the contact type * - first_name The first name on the contact * - last_name The last name on the contact * - title The title of the contact * - company The company name of the contact * - address1 The address 1 line of the contact * - address2 The address 2 line of the contact * - city The city of the contact * - state An array of state info including: * - code The 2 or 3-character state code * - name The local name of the country * - country An array of country info including: * - alpha2 The 2-character country code * - alpha3 The 3-cahracter country code * - name The english name of the country * - alt_name The local name of the country * - zip The zip/postal code of the contact * @param float $amount The amount to charge this contact * @param string $currency The current to charge * @param array $invoice_amounts An array of invoices, each containing: * - id The ID of the invoice being processed * - amount The amount being processed for this invoice (which is included in $amount) * @param array $options An array of options including: * - description The Description of the charge * - return_url The URL to redirect users to after a successful payment * - recur An array of recurring info including: * - start_date The date/time in UTC that the recurring payment begins * - amount The amount to recur * - term The term to recur * - period The recurring period (day, week, month, year, onetime) used * in conjunction with term in order to determine the next recurring payment * @param int $gateway_id The ID of the nonmerchant gateway to fetch, * if null will return all nonmerchant gateways for the currency * @return array An array of HTML, indexed by the gateway name */ rejoice 1 Quote Link to comment Share on other sites More sharing options...
Michael Posted March 5, 2019 Report Share Posted March 5, 2019 That's cause it needs 3 values to work not sure which ones though. rejoice 1 Quote Link to comment Share on other sites More sharing options...
Tyson Posted March 5, 2019 Report Share Posted March 5, 2019 If you're trying to use the API to fetch a non-merchant gateway's payment HTML, see Payments::getBuildProcess as @coreyman mentioned above. The arguments required are the method's parameters. If you are making a merchant CC payment, look at the other end-points available on the same page. rejoice 1 Quote Link to comment Share on other sites More sharing options...
coreyman Posted March 5, 2019 Report Share Posted March 5, 2019 10 minutes ago, Blesta.Store said: That's cause it needs 3 values to work not sure which ones though. Oh yeah I'm aware, I was just pointing him in the right direction rejoice 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.