-
@imdhemy For Example : |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Hi @hilal-hipster, From a purchase event:$subscription = $event->getSubscription()->getProviderRepresentation(); The Each key has a getter method, for example, Using The Subscription Facade:Check the following sections in the main documentation Example /** @var Imdhemy\GooglePlay\Subscriptions\SubscriptionPurchase $subscription */
$subscription = $event->getSubscription()->getProviderRepresentation();
$orderId = $subscription->getOrderId();
$priceAmountMicros = $subscription->getPriceAmountMicros();
$priceCurrencyCode = $subscription->getPriceCurrencyCode(); Still not clear enough, tell me which key from which provider (Google Play, App Store) you need to retrieve and I'll provide an example showing how to get it. |
Beta Was this translation helpful? Give feedback.
-
I have a question App Store provides getPriceAmountMicros() or not? |
Beta Was this translation helpful? Give feedback.
-
Hi @imdhemy public function handle(SubscriptionExpired $event)
{
$notification = $event->getServerNotification();
$subscription = $notification->getSubscription();
$uniqueIdentifier = $subscription->getSubscriptionIdentifier();
$ids = $subscription->getSubscriptionId();
Log::info(sprintf("Google Play PurchasesExp, version: %s", 1));
Log::info(sprintf("Google Play Test NotificationExp, version: %s", $ids));
// Log::info(sprintf("Google Play Test Notification, version Exp: %s", $uniqueIdentifier));
} public function handle(SubscriptionCanceled $event)
{
$notification = $event->getServerNotification();
$subscription = $notification->getSubscription();
$uniqueIdentifier = $subscription->getSubscriptionIdentifier();
$ids = $subscription->getSubscriptionId();
Log::info(sprintf("Google Play Purchasescan, version: %s", 1));
Log::info(sprintf("Google Play Test Notificationcan, version: %s", $ids));
Log::info(sprintf("Google Play Test Notification, version can: %s", $uniqueIdentifier));
}
Please help |
Beta Was this translation helpful? Give feedback.
-
Hello, for App Store and play Store getPriceAmountMicros() and getPriceCurrencyCode methods return undefined? I need to save the subscription price and currency information in my database. |
Beta Was this translation helpful? Give feedback.
Hi @hilal-hipster,
Thank you for creating this topic.
Getting the subscription info is related to the context and the subscription provider.
From a purchase event:
The
getProviderRepresentation()
method returns eitherSubscriptionPurchase
object orReceiptResponse
object based on the provider. The first object represents theResource: SubscriptionPurchase
from Google, and the later object represents theresponseBody
from App Store.Each key has a getter method, for example,
kind
has a getter methodgetKind()
, and so on.Using The Subscription Facade:
Check the following sections in the main documentation