How to add a company logo to paypals SDK V2 - php

I'am trying to add a company-logo by using the PayPal SDK environment in PHP.
I have seen that this is possible, but there is no documentation.
I tried the following without success:
'application_context' =>
[
'return_url' => "https://example.com/return",
'cancel_url' => "https://example.com/cancel",
'image_url' => "https://xyz.de/test/paypal_logo.jpg",
'logo_image' and LOGOIMG do not works also
],
Thanks for any hint in advance.

This depends a bit on the products you use, but generally you can create a Payment Experience Web Profile. See a sample here. After creating it, you will get a Profile ID.
When you initialize your payment, you can pass the Profile ID with the method setExperienceProfileId

Related

stripe manual confirmation + connected account failing (confirmation_method + stripe_account)

I'm using Stripe's PHP SDK in a Laravel project, and I'm having a weird issue with 3d secure payments.
PHP Version : 7.4
Stripe-PHP : 7.75.0
When creating a PaymentIntent on behlaf of a connected stripe account using the stripe_account parameter, and the confirmation_method: 'manual' parameter, there's alway an error stating:
This PaymentIntent pi_XXXXXX cannot be confirmed using your publishable key because its confirmation_method is set to manual. Please use your secret key instead, or create a PaymentIntent with confirmation_method set to automatic.
This is how I created my intent:
$paymentIntentParameters = array(
'amount' => $priceAsCents,
'currency' => 'eur',
'payment_method' => $paymentMethodId,
'confirmation_method' => 'manual',
'confirm' => true,
);
$paymentIntent = StripePaymentIntent::create(
$paymentIntentParameters,
['stripe_account' => $store->stripe_token]
);
I followed everything said here: https://github.com/stripe-samples/accept-a-card-payment/tree/master/without-webhooks
I'm in a case where the webhook doesn't work for me, and where the confirmation_method: 'automatic' doesn't do the job too, because the confirmation is done on the frontend, and we only want cofirmations on the backend.
Is there any quick fix for this?
In order to perform server-side (manual) confirmation, you want to follow this doc. Specifically, instead of using handleCardPayment on the frontend, you use createPaymentMethod on the frontend, use the resulting PaymentMethod with a PaymentIntent on the backend, and then confirm on the backend. The linked doc shows the exact steps.
And for the 3d secure, you need to add handleCardPayment.

How to fill campaign template with repeatablecontent via Mailchimp Marketing API

I have campaing which uses template and I need to send this campaign via Marketing API with 5 (or more) latest job offers. I trying to find the way to do it.
I've tried to use Template Language on simple example.
I've added this block to template: <h3 mc:edit="article_title">Title</h3>
And then I try to update campaign content with PHP library mailchimp/marketing:3.0.27:
$campaign = $this->mailchimp->campaigns->setContent($campaignId, [
'template' => [
'id' => (int) $templateId,
'sections' => [
'article_title' => 'Test title',
],
],
]);
This request runs successfully, but I don't see any changes in response, campaing design or test email.
What I doing wrong? Or maybe there is another way to solve my problem?
I also tried to ask Mailchimp support about this problem, but got no answer.
The truth is that this feature was not implemented and will not work.

mgp25 instagram API Upload Story and Mention a user within it

I am using the mgp25 Instagram API and have the following question,
I want to tag/mention a user within a story. I can easily now make hashtags or add a link to a story with this API, but from the examples and source code I cannot get the concrete code about tagging/mentioning a user in a story like a sticker:
Picture of user mentioning / tagging via Instagram story
I opened already an issue at the GitHub:
https://github.com/mgp25/Instagram-API/issues/1826
This is the code I created from existing source code from the API and from examples, but there is no concrete example for this use case, and it doesn't work:
'story_mentions' =>
[
'user_id' => '123456789',
'x' => 0.5,
'y' => 0.5,
'width' => 0.5661107,
'height' => 0.10647108,
'rotation' => 0.0,
'is_sticker' => true, // Don't change this value.
],
Maybe someone has an Idea or implemented it already, furthermore, the example of the location sticker doesn't work as well :/
Thanks and kind regards!

PayPal - Cancel Pre-approved Payment using API and PA key

Quetion:
How would I cancel a pre-approved payment using PayPal's API operations? I have the Pre-approval key of the payment to be cancelled but I can't find a way to do it.
I did some digging over the internet and found this CancelPreapproval API Operation but that document is not very helping for a starter like me. Few things are missing like what would be the link where I'd send the cancel request? Can't find any example. Need help.
I did tried cancelling the payment by using this code but it fails.
$security_user_id = $neworder->security_user_id;
$security_password = $neworder->security_password;
$security_signature = $neworder->security_signature;
$security_application_id = $neworder->security_application_id;
$headers_array = array("X-PAYPAL-SECURITY-USERID" => $security_user_id,
"X-PAYPAL-SECURITY-PASSWORD" => $security_password,
"X-PAYPAL-SECURITY-SIGNATURE" => $security_signature,
"X-PAYPAL-APPLICATION-ID" => $security_application_id,
"X-PAYPAL-REQUEST-DATA-FORMAT" => "NV",
"X-PAYPAL-RESPONSE-DATA-FORMAT" => "JSON",
);
$pay_result = wp_remote_request('https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval', array('method' => 'POST', 'timeout' => 20, 'headers' => $headers_array, 'body' => $maincode));
This PayPal PHP SDK will make it very quick and easy for you. Just extract it into your project structure as you would any other class, and make sure to setup the config file correctly with your own sandbox and/or live PayPal credentials.
Then you can look in the /templates and you'll see a CancelPreapproval.php setup and ready to go. It'll be fully functional. All you'll have to do is plug in your preapproval key and it'll handle the rest for you successfully.
There are lots of /samples and there is a file in /templates for pretty much every API call PayPal has.
You can get this done within minutes using that class. Let me know if you have any specific questions about it.

getting ci-merchant working please?

I am trying to use the CI-Merchant library for codeigniter. I have installed this via a spark, as recommended. The documentation example that is on the ci-merchant.org website does not specifically show the spark being loaded, and therefor I am uncertain that I am using the system correctly. Can anyone look at the code below and see if they can spot what is going on. I wish to use "sagepay server" as my merchant in case that is helpful.
Regards and thanks in antipation
$this->load->spark('ci-merchant-2.1.1');
$this->load->library('merchant');
$this->merchant->load('sagepay_servber');
$settings = array(
'vendor' => 'fluidbrandinglt',
'test_mode' => TRUE,
'simulator_mode' => FALSE
);
$this->merchant->initialize($settings);
$params = array(
'amount' => 100.00,
'currency' => 'USD',
'return_url' => 'https://www.example.com/checkout/payment_return/123',
'cancel_url' => 'https://www.example.com/checkout'
);
$response = $this->merchant->purchase($params);
When I run the above code, I just get a blank screen with zero feedback about what is going on. I know that I have an encryption password which Sagepay provided me, but again I cannot see where this is configured or even if its relevant.
You should change
$this->merchant->load('sagepay_servber');
with.
$this->merchant->load('sagepay_server');
There is a 'b' in your load statement. Small detail but it does give headaches.

Categories