I created an app with stripe express account. Everything is working well except that the name on the receipt is my platform name instead of the connected account name
.
My plat form has businesses. Each business has their customer.
When the customer of each business pays for their services, my platform should send the receipt in the business name not my name. I am using destination charges:
try{
$charge=$stripe->charges->create([
"customer"=>$this->stripeCustID,
"amount" => $amount,
"currency" => "cad",
"description" => $this->input->post('product'),
"statement_descriptor" => mb_strimwidth($company->full_name, 0, 22, ''),
'receipt_email' => $customerEmail,
'application_fee_amount' => $fee,
'on_behalf_of' => $destinationAcct,
'transfer_data' => [
'destination' => $destinationAcct,
],
]);
What do I need to change? What am I doing wrong. I called stripe and most of them tech team have no idea how to fix this
Related
I'm using the Hubspot API to create new contacts and would like to automatically set the owner when the contact is created. I know this is possible without using the API via Workflows, however I'd like to use the API for that.
Here's my code right now (which works, just missing the contact owner):
$data = [
'properties' => [
['property' => 'firstname', 'value' => $contact->first_name],
['property' => 'lastname', 'value' => $contact->last_name],
]
];
$body = json_encode($data);
$response = $client->request('POST', '/contacts/v1/contact/email/'.$user->email.'/profile',
['query' => ['hapikey' => $hubspot_key, 'body' => $body]);
I eventually found a way to achieve this:
Go to your Hubspot instance, then Settings and Properties
Search for "Contact Owner" and click on Edit
In "Field type", identify the Owner's ID value
Then in your API call, simply pass this property:
$data['properties'][] = ['property' => 'hubspot_owner_id', 'value' => 123456];
You can find out more about the hubspot_owner_id property (which is internal to Hubspot, this is not a custom property) in Hubspot's documentation.
It will automatically assign the newly created (or updated) Hubspot contact to the related Owner (Hubspot User).
I’ve been trying to find a way to get a user’s roles back through the Moodle webservice API.
I know there are no endpoints to do this but I cannot retrieve them directly from the database because I do not have access to the client’s database.
Is there another way to do that?
You may code a solution along this lines:
Create a barebones plugin with the usual boilerplate code (version.php and so on), for example a local plugin. You can use this other plugin to generate the boilerplate code: https://moodle.org/plugins/tool_pluginskel
In 'db/services.php' register a new external function and expose it in a new or existing service. Docs here: https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin and here https://docs.moodle.org/dev/Web_services_API . For example:
$functions = [
'local_myplugin_get_user_roles' => [
'classname' => external::class,
'methodname' => 'get_user_roles',
'description' => 'gets user roles',
'type' => 'read',
],
];
$services = [
'My services' => [
'functions' => [
'local_myplugin_get_user_roles',
],
'enabled' => 1,
'restrictedusers' => 0,
'shortname' => 'local_myplugin',
'downloadfiles' => 0,
'uploadfiles' => 0,
],
];
Write an external class (for example in a external.php file) for your plugin (referenced in the function definition you coded before). In this class write the code for the defined external function (that will fetch the roles for a user given a user id, for example), including the input and output handlers. Example here: https://docs.moodle.org/dev/External_functions_API#externallib.php
Within your external function, to get a list of user roles given a context, userid, etc. you may use the global helper get_user_roles. Do not forget to write in this external function the code needed to validate input parameters and so on.
To properly expose your new service and external function to an external system you need to follow this settings guidelines as a Moodle admin: YOUR_MOODLE_INSTANCE_URL/admin/settings.php?section=webservicesoverview . At the end you will generate a user (web service consumer) and a token, that you can set in your external system to consume the Moodle service.
Happy coding.
From outside system built in PHP, I wrote this following to call API for create customer account:
'customer' =>
array (
'first_name' => $_POST['datalog']['firstName'],
'last_name' => $_POST['datalog']['lastName'],
'email' => $_POST['datalog']['email'],
'verified_email'=> true,
'password'=> $rand_pass,
'password_confirmation' => $rand_pass,
//'send_email_welcome' => true,
'send_email_invite' => true,
),
Creation of customers are working successfully but they did not receive any invitation email. I have followed the Shopify Documentation : https://help.shopify.com/api/reference/customer
Try using the Customer Invites API: https://help.shopify.com/api/reference/customer#send_invite
I'm using the oneAuth bundle in laravel, based on NinjAuth from Fuel by Phil Sturgeon, I believe, and trying to get the user's email address.
I've added the proper scope to my request, and the LinkedIn auth screen successfully asks for the users permission for basic profile AND email address.. so far, so good..
A possible issue is: what is the proper name of the email field?
I've found references to email-address, emailAddress, 'emailaddress`...
The docs indicate email-address, but its not working for me :)
I'm using the URL: https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url,email-address)?format=json
This is the problematic snippet from /bundles/oneauth/libraries/oauth/provider/linkedin.php
// Create a response from the request
return array(
'uid' => array_get($user, 'id'),
// 'email' => array_get($user, 'email-address)',
// 'email' => array_get($user, 'emailAddress)',
'name' => array_get($user, 'firstName').' '.array_get($user, 'lastName'),
'image' => array_get($user, 'pictureUrl'),
'nickname' => $nickname,
'description' => array_get($user, 'headline'),
'location' => array_get($user, 'location.name'),
'urls' => array(
'linkedin' => $linked_url,
),
);
If I uncomment the email field, the request fails somehow (URL still shows mysite.com/connect/callback but the favicon shows linkedin and i get ablank page in chrome: "Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.")
If the email line in the code above IS commented out, I successfully receive all the other details and a new record is added to my users table and the table oneauth_clients, but email is naturally blank..
I must be missing something simple!
Update
The request URL works with email-address, but returns a json object containing emailAddress!!
The script still dies if the return array code above includes emailAddress...
Here is someone's success story:
"I made these two changes to the library and the demo.php respectively:
const _URL_REQUEST = 'https://api.linkedin.com/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress';
$response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url,email-address)');
The issue was that the Request Token Call is:
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url,email-address)?format=json
but the json response is:
array(8) {
["emailAddress"]=>
string(18) "email#email.com"
["firstName"]=>
string(3) "Tim"
...
Note that in the first case email is named email-address, in the second emailAddress.
The secondary problem was a shortcoming of my code - now working perfectly!
I run this code
print_r($list->subscribers);
You can see at the result I pasted below that there is no subscriber name and email... I tried all the sample codes i could find in the web and all of them have the same result.
Now my question is, how to get the emails of all the subscribers aside from the code I used above?
[last_followup_sent_link] => https://api.aweber.com/1.0/accounts/6023076/lists/20746327/campaigns/f105556951
[city] =>
[http_etag] => "d6a652460dae642a0732ecf75003de4t05be96f66a1-7c14178a7fa0b2a2b7fb74be93ff058ac477ea43"
[ad_tracking] => my_web_form
[dma_code] =>
[last_followup_message_number_sent] => 1
[last_followup_sent_at] => 2011-11-17 04:52:19-05:00
[latitude] =>
[is_verified] => 1
[status] => subscribed
[area_code] =>
[unsubscribed_at] =>
[self_link] =>
[unsubscribe_method] =>
[resource_type_link] => https://api.aweber.com/1.0/#subscriber
[subscription_method] => signup form
[subscribed_at] => 2011-11-17 04:51:41-05:00
[region] =>
[longitude] =>
[verified_at] => 2011-11-17 04:52:19-05:00
[country] =>
The problem is that you did not grant access to subscriber info in your app. Choose Edit -> Permission Settings, put a check mark in the Request Subscriber Info box then choose save permission settings and then choose save. If done correctly, you should be back at the apps page and it will now be displaying the additional permissions.
You will have to reset the key/secret and then get a new Oauth token and secret as well. When that takes place and it asks for permission, you should see a box above the login credentials detailing the request for personal subscriber details. If you don't see it, something is wrong.
Once completed you should see all subscriber data including email address.