I'm using a hipay wallet test account and used there webservices to integrate. Transaction is working fine but problem is that i'm not getting the response in the page, it is suppossed to get in $_POST['xml'] on the response page
$setUrlAck =show_page_link("payment/hipay_new/response.php",true);
Below is my code
if ($PaymentDetails['sel_payment_env'] == 1) {
$wsdl = 'https://ws.hipay.com/soap/subscription?wsdl'; //for live
} else {
$wsdl = 'https://test-ws.hipay.com/soap/subscription?wsdl';//for testing
}
// If the payment is accepted, the user will be redirected to this page
$setURLOk= show_page_link(FILE_THANKS."?add=success&OrderNo=".$orderid,true);
// If the payment is refused, the user will be redirected to this page
$setUrlNok=show_page_link(FILE_THANKS."?cancleMsg=true",true);
// If the user cancels the payment, he will be redirected to this page
$setUrlCancel=show_page_link(FILE_THANKS."?cancleMsg=true",true);
// The merchant?s site will be notified of the result of the payment by a call to the script
$setUrlAck =show_page_link("payment/hipay_new/response.php",true);
$initArray = array(
'wsLogin' => $wsLogin, // Your wsLogin
'wsPassword' => $wspassword, // Your wsPassword
'websiteId' => $txt_Merchant, // Your webSiteId
'categoryId' => $PaymentDetails['txt_category_id'], // Your website category ID (https://test-payment.hipay.com/order/list-categories/id/(websiteId))
'customerEmail' => $customer_email, // Your customers' email
);
$options = array(
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
'cache_wsdl' => WSDL_CACHE_NONE,
);
$client = new SoapClient($wsdl, $options);
$data = array(
'currency' => $currency_code,
'rating' => 'ALL',
'locale' => 'fr_FR',
'manualCapture' =>1,
'label' => 'My label is a Manged Subscrption Test Service ',
'customerIpAddress' => $_SERVER["REMOTE_ADDR"],
'merchantReference' => 'AZERTY',
'urlCallback' => $setUrlAck, // Here in this page i'm suppossed to get the response in $_POST
'urlAccept' => $setURLOk,
'urlCancel' =>$setUrlCancel,
'payments' => array(
'initial' => array(
'name' => 'Payment',
'description' => 'Payment for printing products',
'amount' => $price,
'subscriptionId' => 'QWERTY',
'periodType' => 'normal',
'recurrence' => array(
'frequency' => 0,
'duration' => 'managed'
),
),
),
);
Kindly guide me if anyone got through the same issues
The issue is solved, problem was that my firewall setting was blocking the response
Related
I need to use Paypal checkout in order to accept immediate payment on my Laravel website, and I switched from old Paypal PHP SDK to the new Paypal checkout SDK to support API V2.
I followed the samples codes that provided in the new SDK, I have to create all workflow on my server, so I created an order with intent=CAPTURE with other required fields.
$request = new OrdersCreateRequest();
$request->headers["prefer"] = "return=representation";
$request->body = $this->buildMinimumRequestBody(...);
$response = $this->client->execute($request);
// redirect the user to approval link.
Order body:
return array(
'intent' => 'CAPTURE',
'application_context' =>
array(
'return_url' => 'https://example.com/return',
'cancel_url' => 'https://example.com/cancel',
'locale' => 'en-US',
'user_action' => 'PAY_NOW',
'shipping_preference'=> 'NO_SHIPPING'
),
'purchase_units' =>
array(
0 =>
array(
'amount' =>
array(
'currency_code' => 'USD',
'value' => 12,
'breakdown' =>
array(
'item_total' =>
array(
'currency_code' => 'USD',
'value' => 10,
),
'tax_total' =>
array(
'currency_code' => 'USD',
'value' => 2,
),
),
),
),
),
);
After the user redirected to approval URL and approving it, I execute the payment like below:
$response = $this->client->execute(new OrdersCaptureRequest($payment_id));
Below is the response after executing the payment.
Order and Payment response
So after directing the user to the approval page, then after approving the payment, then executing the order, I got the above result in the attached screenshot which shows the Order status is completed but the payment status is still "pending" and the reason is "PENDING_REVIEW", so I would like to ask if there is any error or something missed to make the payment immediately without waiting for review with an example.
Thanks.
I am getting error from Facebook Marketing API when creating Leadgen Form. I followed Facebook guide but nothing worked yet. API documentation link
In previous I was successfully create leadgen legal content, leadgen context cards, leadgen conditional questions group and conditional questions group csv. After that I am trying to create Leadgen Form but API returns Invalid parameter
$config = Config::get('facebook');
$data['account_id'] = 'act_'.$config['ad_account_id'];
$data['page_id'] = $config['page_id'];
$api = Api::init($config['app_id'], $config['app_secret'], $config['access_token']);
// Init facebook
$legal_params = array(
'privacy_policy' => array(
'url' => 'http://example.com/privacy-policy',
'link_text' => 'Privacy Policy'
),
'custom_disclaimer' => array(
'title' => 'Terms and Conditions',
'body' => array(
'text' => 'My custom disclaimer',
'url_entities' => array(
array("offset" => 3, "length" => 6, "url" => 'http://example.com/privacy-policy')
),
),
'checkboxes' => array(array(
"is_required" => false,
"is_checked_by_default" => false,
"text" => "Allow to contact you",
"key" => "checkbox_1",
))
),
);
$legal_res = Api::instance()->call('/'.$data['page_id'].'/leadgen_legal_content',
RequestInterface::METHOD_POST,
$legal_params)->getContent();
$legal_content_id = $legal_res['id'];
$contex_params = array(
'title' => 'Thank You',
'style' => 'LIST_STYLE',
'content' => array(
'Easy sign-up flow',
'Submit your info to have a chance to win',
),
'button_text' => 'Get started',
);
$contex_res = Api::instance()->call('/'.$data['page_id'].'/leadgen_context_cards',
RequestInterface::METHOD_POST,
$contex_params)->getContent();
$context_card_id = $contex_res['id'];
// Conditional Questions
$conditional_request = Api::instance()->prepareRequest(
'/'.$data['page_id'].'/leadgen_conditional_questions_group',
RequestInterface::METHOD_POST);
$conditional_request->getFileParams()->offsetSet(
'conditional_questions_group_csv',
(new FileParameter(public_path().'/facebook/lead-csv-form.csv'))->setMimeType("text/csv"));
$csv_data = Api::instance()->executeRequest($conditional_request)->getContent();
$questions_group_id = $csv_data['id'];
// Create Lead Form
$form = new LeadgenForm(null, $data['page_id']);
$form->setData(array(
LeadgenFormFields::NAME => 'Test LeadAds Form Name',
LeadgenFormFields::FOLLOW_UP_ACTION_URL => 'https://www.facebook.com/examplepage',
LeadgenFormFields::QUESTIONS => array(
(new LeadGenQuestion())->setData(array(
LeadgenQuestionFields::TYPE => 'EMAIL',
)),
(new LeadGenQuestion())->setData(array(
LeadgenQuestionFields::TYPE => 'CUSTOM',
LeadgenQuestionFields::LABEL => 'Country',
'conditional_questions_group_id' => $questions_group_id,
'dependent_conditional_questions' => array(
array('name' => 'State'),
array('name' => 'City'),
)
)),
),
'block_display_for_non_targeted_viewer' => true,
'context_card_id' => $context_card_id,
'legal_content_id' => $legal_content_id,
));
$form->create();
I am using Laravel push notification library, for pushing notification.
However, i can easly get responses for GCM responses for Android Device.
But unable to get APNS response.
$message = PushNotification::Message("New Messages",$params['payload']);
$collection = PushNotification::app('appNameIOS')
->to($params['reg_id'])
->send($message);
foreach ($collection->pushManager as $push) {
$response = $push->getAdapter()->getResponse();
}
Make sure you have followed proper format as below:-
//iOS app
PushNotification::app(['environment' => 'development',
'certificate' => '/path/to/certificate.pem',
'passPhrase' => 'password',
'service' => 'apns']);
$devices = PushNotification::DeviceCollection(array(
PushNotification::Device('token', array('badge' => 5)),
PushNotification::Device('token1', array('badge' => 1)),
PushNotification::Device('token2')
));
$message = PushNotification::Message('Message Text',array(
'badge' => 1,
'sound' => 'example.aiff',
'actionLocKey' => 'Action button title!',
'locKey' => 'localized key',
'locArgs' => array(
'localized args',
'localized args',
),
'launchImage' => 'image.jpg',
'custom' => array('custom data' => array(
'we' => 'want', 'send to app'
))
));
$collection = PushNotification::app('appNameIOS')
->to($devices)
->send($message);
// get response for each device push
foreach ($collection->pushManager as $push) {
$response = $push->getAdapter()->getResponse();
}
According to these (and many more) questions on SO:
stackoverflow.com/questions/18856204
stackoverflow.com/questions/20741618
stackoverflow.com/questions/31967093
stackoverflow.com/questions/19068762
stackoverflow.com/questions/30936507
I figured out, that the main keys for silent push-notification and for the method
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
to be called in the background are: the payload, iOS version > iOS 7, enabled background mode with "Remote notifications" and registering push notifications in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method.
I did all of those things, but the method mentioned above, that supposed to be called in the background, is only being called while the app is foreground. This is how I form my payload in php:
$contents = json_encode(array(
'aps' => array(
'content-available' => '1',
'sound' => '',
'alert' => '',
),
'where' => array(
'deviceType' => array(
'$in' => array('ios', 'android'),
),
),
'data' => array(
'title' => $this->subject,
'msg' => $this->message,
'date' => date('d.m.Y H:i', time() + (60 * 60 * 2)),
'key' => APPKEY,
'ids' => $ids,
),
));
and this is what I get in Xcode console, as I am able to NSLog the payload when app is in foreground:
{
aps = {
};
date = "21.10.2015 11:01";
ids = (
259,
257,
256,
);
key = xpy3fq4t3wn9;
msg = test11;
title = aatest1;
}
What am I doing wrong? Why isnt "content-available = 1" in Xcode console? Or is there any other reason why appDelegate method isnt being called in background?
Im using iOS 8.1.3, Parse as Push-Notification provider.
I was able to solve my problem just by trying different payload combinations, ended up with this one:
$contents = json_encode(array(
'where' => array(
'deviceType' => array(
'$in' => array('ios', 'android'),
),
),
'data' => array(
'title' => $this->subject,
'msg' => $this->message,
'date' => date('d.m.Y H:i', time() + (60 * 60 * 2)),
'key' => APPKEY,
'ids' => $ids,
'aps' => array(
'content-available' => '1',
'sound' => '',
'alert' => '',
),
),
));
Looks like 'aps' has to be in 'data' array. Now the app delegate method is being called in background and I can see "content-available = 1" in Xcode console.
Can not achieve to upload a file via soap api to Cart. I want user to add a product to cart with a required custom option which is an image.
So spent hours, can not find any resource/documentation/same problem anywhere but actually figure out, soap api requires array (ok, but what are the parameters?) And It does not throw any error if something goes wrong (weird?)
So in practice what I am willing to achieve:
// Prepare image
$newImage = array(
'file' => array(
'name' => $_FILES['uploadedfile']['name'],
'content' => base64_encode(file_get_contents($_FILES['uploadedfile']['tmp_name'])),
'mime' => 'image/png'
),
'label' => $_FILES['uploadedfile']['name']
);
// Prepare product & Custom options
$arrProducts = array(
array(
'product_id' => '7',
'qty' => 1,
'options' => array ( '30' => $newImage ) // optionId_1 => optionValue_1
)
);
// lets do adding
$resultCartProductAdd = $client->call(
$session,
'cart_product.add',
array(
$quoteId,
$arrProducts
)
);
The problem is, the image is not uploaded to /media/custom_options/quote folder where should belongs to and when order complete can not see anywhere. As I mentioned, there is no error thrown while this process..
Thanks for helping me out.
Please try this....
$arrProducts = array(
array(
'product_id' => '7',
'qty' => 1,
'options' => array ( 'options_30_file' => $newImage,'options_30_file_action'=>'save_new' )
)
);
or
$arrProducts = array(
array(
'product_id' => '7',
'qty' => 1,
'options_30_file' => $newImage,
'options_30_file_action'=>'save_new'
)
);
Let me if any issue