When getting ready to add a gateway, the first thing you'll want to do is find out what your gateway type is and what credentials you need to set it up. You can visit Spreedly for the details if you prefer, instead of using the below code.
Spreedly::gateway()->setup();
To see the gateways that you've created, you'd make the following call. The gateways returned will be sorted by created_at and then token. It returns the oldest 20 gateways.
Spreedly::gateway()->all();
// If you have more than 20 gateways, you can always paginate to get the remainder after the token specified.
Spreedly::gateway()->all($gatewayToken);
After you can find out what you need to create a particular gateway using Spreedly::gateway()->setup()
. Use the following code.
// Example: Create a 'Test' Gateway.
Spreedly::gateway()->create('test');
// Example: Create a 'PayPal' Gateway.
Spreedly::gateway()->create('paypal', [
'mode' => 'delegate',
'email' => 'your_paypal_email_address'
]);
You can't update a gateway's type, but you can update its credentials if they change.
Spreedly::gateway($gatewayToken)->update([
'login' => 'new_login',
'password' => 'new_password'
]);
Gateways can't be deleted (since they're permanently associated with any transactions run against them), but the sensitive credential information in them can be redacted so that they're inactive.
Spreedly::gateway($gatewayToken)->disable();