|
It allows us to use Scriptcase built-in APIs. We currently offer integration with the Mandrill and Amazon SES APIs.
This macro has two parameters:
| Parameters |
Description |
| $profile |
Required parameter. Can be passed empty '' or contain the gateway name configured in "tools> API". |
| $arr_settings |
This parameter is optional as long as the "profile" is not empty. When informed, this parameter must contain an Array with the Gateway used and the API key. |
Example 1 - Parameter $arr_settings, array with the API information
$settings = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );
$mandrill = sc_call_api('', $settings);
Example 2 - Sending email using mandrill.
$txt_no_tags = strip_tags({msg});
$arr_merge = array(
'name' => '',
'type' => 'to',
'email' => 'exemplo@exemplo.com'
);
$var_config = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );
$mandrill = sc_call_api('', $var_config);
$var_msg = array(
'from_email' => {from_email},
'from_name' => {from_name},
'html' => {msg},
'text' => $txt_no_tags,
'to' => array($arr_merge),
'subject' => {subject},
'important' => true,
'auto_text' => null,
'auto_html' => null,
'inline_css' => null,
'metadata' => array('website' => 'www.scriptcase.net')
);
$async = false;
$retorno = $mandrill->messages->send($var_msg, $async);
Example 3 - Sending SMS using clickatell.
$var_config = array(
'message' => [
'to' => {sms_to},
'message' => {sms_txt},
],
'settings' => [
'gateway' => {gateway},
'auth_token' => {auth_token},
]
);
sc_send_sms($var_config);
Example 4 - Using the macro with PagSeguro
$arr_settings = [
'gateway' => 'pagseguro',
'environment' => 'sandbox',
'auth_email' => 'exemplo@gmail.com',
'auth_token' => '72AE21503DDA4840BE1DC7945F6D1CE1'
];
sc_call_api('',$arr_settings);
Example 5 - Using the macro with PayPal
$arr_settings = [
'gateway' => 'paypal',
'environment' => 'sandbox',
'auth_email' => 'exemplo@gmail.com',
'auth_token' => '72AE21503DDA4840BE1DC7945F6D1CE1'
];
sc_call_api('',$arr_settings);
|