Stripe
Stripe is a payment gateway that allows individuals or businesses to receive online payments.
To use this API, you need an account. Here is the link to log in or create a new account if you don’t have one: https://dashboard.stripe.com/login
Setting up a Profile
En el menú Herramientas > API, puede crear perfiles de API para utilizarlos en sus proyectos. De esta forma, solo tendrá que informar sus credenciales una vez para usar la API en su proyecto.
Vea cómo obtener las credenciales necesarias para configurar el perfil.
Al realizar el deploy de su proyecto, deberá configurar las credenciales de la API en Prod, accediendo al menú API.

Al realizar el deploy de su proyecto, deberá configurar las credenciales de la API en Prod, accediendo al menú API.
To create a profile, we must add the following information:
Nombre
Define el nombre para identificar el perfil de la API. Este nombre es único y se utilizará para referenciar el perfil de la API en las aplicaciones de su proyecto.
Mode
El modo define la disponibilidad del Perfil en Scriptcase.
-
Público - Los usuarios de todos los proyectos podrán visualizar y utilizar el perfil creado.
-
Proyecto - Los usuarios podrán visualizar y utilizar el perfil en el proyecto donde fue configurado.
-
Usuario - Solo el usuario que creó el perfil podrá visualizarlo y utilizarlo en las aplicaciones.
Independientemente del modo utilizado para la creación, los perfiles solo pueden ser editados por usuarios con acceso de administrador en el proyecto. Vea cómo definir los niveles de acceso de los usuarios en Scriptcase.
Gateway
Define la API que se utilizará para crear el perfil.
API Key
Enter the API secret key
Secret Key
-
Test Mode Secret Key: Use this key to authenticate requests to your server when in test mode. By default, you can use this key to make any API request without restriction.
-
Production Mode Secret Key: Use this key to authenticate requests to your server when in production mode. By default, you can use this key to make any API request without restriction.
Public Key
-
Test Mode Publishable Key: Use this key for testing purposes in the client-side code of your mobile application.
-
Production Mode Publishable Key: Use this key when you are ready to launch your application, in the client-side code of your mobile or web application.
Usage Example
See below for some examples of API usage.
Example using the API profile in the sc_call_api macro
// Chamada da Macro utilizando perfil da API
$gateway = sc_call_api('stripe');
// Passando os valores, descrição e tipo de pagamento.
$gateway->charges->create([
'amount' => 2000,
'currency' => 'brl',
'source' => 'tok_mastercard',
'description' => 'My First Test Charge with Scriptcase',
]);
Exemplo de retorno da API
{
"id": "ch_3M9wLeLZM9w2hLeLZ4yW2h",
"object": "charge",
"amount": 2000,
"amount_captured": 2000,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_3M9wLeLZM9w2hLeLZ",
"billing_details": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"calculated_statement_descriptor": "Stripe",
"captured": true,
"created": 5555555555,
"currency": "brl",
"customer": null,
"description": "My First Test Charge with Scriptcase",
"destination": null,
"dispute": null,
"disputed": false,
"failure_balance_transaction": null,
"failure_code": null,
"failure_message": null,
"fraud_details": {
},
"invoice": null,
"livemode": false,
"metadata": {
},
"on_behalf_of": null,
"order": null,
"outcome": {
"network_status": "approved_by_network",
"reason": null,
"risk_level": "normal",
"risk_score": 36,
"seller_message": "Payment complete.",
"type": "authorized"
},
"paid": true,
"payment_intent": null,
"payment_method": "card_3M9wLeLZM9w2hLeLZ",
"payment_method_details": {
"card": {
"brand": "mastercard",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": null
},
"country": "US",
"exp_month": 11,
"exp_year": 2023,
"fingerprint": "mF8TiHPLLuXUU78G",
"funding": "credit",
"installments": null,
"last4": "4444",
"mandate": null,
"network": "mastercard",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTTlVI6LdMHlXekxkKKzgn...",
"refunded": false,
"review": null,
"shipping": null,
"source": {
"id": "card_mFuXUU78G8TiHPLL",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "MasterCard",
"country": "US",
"customer": null,
"cvc_check": null,
"dynamic_last4": null,
"exp_month": 11,
"exp_year": 2023,
"fingerprint": "U8GUm7LF8TLuiHPX",
"funding": "credit",
"last4": "4444",
"metadata": {
},
"name": null,
"tokenization_method": null
},
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Exemplo utilizando parâmetro $arr_settings na macro sc_call_api
$apiKey = 'YOU_API_KEY';
$arr_settings = array('settings' => ['gateway' => 'stripe', 'apiKey'=> $apiKey] );
$gateway = sc_call_api('', $arr_settings);
$response = $gateway->customers->all(['limit' => 5]);
echo "<pre>";
print_r($response);